Lecture 30: Plotting. --------------------- x =-1:0.1:1 x = Columns 1 through 4 -1.0000 -0.9000 -0.8000 -0.7000 Columns 5 through 8 -0.6000 -0.5000 -0.4000 -0.3000 Columns 9 through 12 -0.2000 -0.1000 0 0.1000 Columns 13 through 16 0.2000 0.3000 0.4000 0.5000 Columns 17 through 20 0.6000 0.7000 0.8000 0.9000 Column 21 1.0000 f = exp(x) f = Columns 1 through 4 0.3679 0.4066 0.4493 0.4966 Columns 5 through 8 0.5488 0.6065 0.6703 0.7408 Columns 9 through 12 0.8187 0.9048 1.0000 1.1052 Columns 13 through 16 1.2214 1.3499 1.4918 1.6487 Columns 17 through 20 1.8221 2.0138 2.2255 2.4596 Column 21 2.7183 ; f = exp(x); %create the graph of f plot(x,f) hold on g = log(x+2); openvar('g', g); plot(x,g,'--'); hold off plot(x,f,'r+') plot(x,g,'go') %plots in polar coordinates t = 0:0.2:2; r = t^2-1; ??? Error using ==> ^ Matrix must be square. r = t.^2-1; polar(t,r); hold on r2 = t./10-1; polar(t,r2,'g--'); %3d plots xa = -1:0.1:1; ya = -1:0.1:1; [x,y] = meshgrid(xa,ya); openvar('x', x); z = cos(x.*y); mesh(x,y,z); hold off mesh(x,y,z); view(10,20); %3d plot of a curve t = 0:0.1:10*pi; plot3(cos(t),sin(t),t); %level curves, "contours" mesh(x,y,z); contour(z); h = contour(z,30); clabel(h, 'manual'); Please wait a moment... Carefully select contours for labeling. When done, press RETURN while the Graph window is the active window. %subplots figure subplot(2,3,5); mesh(x,y,z); subplot(2,3,3); mesh(x,y,z); view(10,20); diary off