I need to plot x = cos(u)*cos(v), y=cos(v)*sin(u), z = -sin(v) where u,v both are from (0,\pi). I looked at fplot3
function but it takes only one parameter. Can anyone point to some function or is there some other way like writing a script to do the plotting?
You can use fsurf
for parametric surface plots. fsurf
accepts two inputs, u
, and v
.
% your functions
f_x = @(u,v) cos(u).*cos(v);
f_y = @(u,v) cos(v).*sin(u);
f_z = @(u,v) -sin(v);
% plot
umin = 0;
umax = pi;
vmin = 0;
vmax = pi;
figure(1); clf;
fsurf(f_x,f_y,f_z, [umin umax vmin vmax])
You can also check out fcontour
and fmesh
.