%% Parameterized Surface Plot
% Plot the parameterized surface
% \matrix{x = r\cos(u)\sin(v) \cr y = r\sin(u)\sin(v) \cr z = r\cos(v)
% \cr {\rm where\quad} r = 2+\sin(7u+5v)}
% for 0<u<2\pi and 0<v<\pi. Add light to the surface using camlight.

r = @(u,v) 2 + sin(7.*u + 5.*v);
funx = @(u,v) r(u,v).*cos(u).*sin(v);
funy = @(u,v) r(u,v).*sin(u).*sin(v);
funz = @(u,v) r(u,v).*cos(v);
fsurf(funx,funy,funz,[0 2*pi 0 pi]) 
camlight

% Copyright 2012 The MathWorks, Inc.