% this is a demo for cylindrical coordinates % o = [0,0,0]; % origin will be shifted otherwise we won't see the arrows inside our ellipsoid arrow3(o, [1,0,0],'yellow'); arrow3(o, [0,1,0],'yellow'); arrow3(o, [0,0,1],'magenta'); % this plots the i,j,k, vectors zmin = 0; zmax = 4; % plotting window % in fact, even to plot the cylinder, we need to use these dtheta = pi/48; r = 2; t = 0:dtheta:2*pi; [theta,Z] = meshgrid(t, zmin:0.2:zmax); X = r*cos(theta); Y = r*sin(theta); Z = X*0 + theta; surf(X,Y,Z,'FaceColor',[0.8 1 0.8]); % surface plotting % now plot the 3d spiral t = 0:0.2:8; theta = t; x = r*cos(theta); y = r*sin(theta); z = t/2; hold on plot3(x,y,z,... 'LineWidth',2); hold off