clear clc clf intercepts pause hold off x=0:0.1:3.*pi; z1=sin(x); z2=sin(2.*x); z3=sin(3.*x); y1=zeros(size(x)); y3=ones(size(x)); y2=y3./2; plot3(x,y1,z1,'r',x,y2,z2,'b',x,y3,z3,'g') grid on xlabel('x-axis'), ylabel('y-axis'), zlabel('z-axis') pause theta=0:0.1:10.*pi; plot3(sin(theta),cos(theta),theta) grid on pause turns=40.*pi; theta=linspace(0,turns,4000); x=cos(theta).*(turns-theta)./turns; y=sin(theta).*(turns-theta)./turns; z=theta./turns; plot3(x,y,z) grid on text(0.5,0.5,0.75,'Here is a piece of text!'); for in = 1:2 pause N = 20; dvx = rand(1, N) - 0.5 % random v changes dvy = rand(1, N) - 0.5 dvz = rand(1, N) - 0.5 vx = cumsum(dvx); % integrate to get v vy = cumsum(dvy); vz = cumsum(dvz); x = cumsum(vx); % integrate to get pos y = cumsum(vy); z = cumsum(vz); plot3(x,y,z) grid on title('all 3 axes varying with parameter t') text(0,0,0,'start'); text(x(N),y(N),z(N),'end'); end pause x=-3:3; y=-3:3; [xx,yy]=meshgrid(x,y) zz=xx.^2 + yy.^2; mesh(xx,yy,zz) pause hidden off pause [x,y,z]=peaks(30); mesh(x,y,z) axis tight xlabel('x-axis'); ylabel('y-axis'); zlabel('z-axis') pause meshc(x,y,z) axis tight pause meshz(x,y,z) axis tight pause waterfall(x,y,z) axis tight pause surf(x,y,z) axis tight pause shading flat pause shading interp pause colorbar pause surf(x,y,z,y) axis tight shading interp pause C=del2(z); % compute Laplacian surf(x,y,z,C) axis tight shading interp pause [xx,yy]=meshgrid(-4.*pi:pi./20:4.*pi); R=sqrt(xx.^2 + yy.^2)+eps; % radius zz=sin(R)./R; surf(xx,yy,zz) axis tight shading interp pause lightangle(60, 45) pause facets = 120; len = 2; radius = 1; thr = linspace(0, 2*pi, facets); xr = linspace(0, len, facets); [x, th] = meshgrid( xr, thr ); y = radius * cos(th); % Note 1 z = radius * sin(th); surf(x, y, z); shading interp colormap bone % Note 2 axis equal,axis tight,axis off % Note 3 lightangle(60, 45) % Note 4 alpha(0.8) % Note 5 view(-20, 35) pause thr = linspace(0, 2*pi, facets); % range of theta phir = linspace(0, pi, facets); % range of phi [th, phi] = meshgrid( thr, phir ); x = radius * cos(phi); y = radius * sin(phi) .* cos(th); z = radius * sin(phi) .* sin(th); surf(x, y, z); shading interp colormap copper axis equal, axis tight, axis off lightangle(60, 45) pause colormap jet kleinbottle lightangle(60, 45) pause exploded = false kestrel pause exploded = true kestrel