function []=code4;
% Draw a surface in cylindrical coordinates
% Draw z=Sin(t)Cos(r) or Sint(2t)Cos(r) .

% Set up your domain for r and theta. Use t for theta.
minr=0; maxr=10; dr=0.05;
%minr=-0.9; maxr=0.9; dr=0.05; % see below
mint=0; maxt=2.01*pi; dt=0.05;
[r,t]=meshgrid(minr:dr:maxr,mint:dt:maxt);

% Enter your function z=f(r,t)
z=sin(2*t).*cos(r);
%z=sin(t).*cos(r);
%z=r;    % A cone
%z=cos(r);  % Change maxr to 30
% ----------------------------------------------------
% Change minr, maxr above to minr=-0.9; maxr=0.9; dr=0.05;
%z=cos(t)./sqrt(1-r.^2.*(sin(t)).^2);
%-----------------------------------------------------
% Convert from cylindrical to rectangular coordinates
[x,y,z]=pol2cart(t,r,z); 

% Plot the surface
surf(x,y,z)
 colorbar 'v';
 shading interp;
 
%=======================================

xlabel('x'); ylabel('y'); zlabel('z');
title('Cylindrical');
