Matlab surface transform with color change, contour, and code to show how

Published 2012-02-01
How do I do it? Check the code below for yourself and LEARN!
code:
xx = -10:.15:10;
yy = -10:.15:10;
[xx,yy] = meshgrid(xx,yy);
zz = sin(xx).*cos(xx) + sin(yy).*cos(xx);
zz2 = -zz;

numframes = 120;
figure(1)
set(gca,'NextPlot','replacechildren');
FF(120) = struct('cdata',[],'colormap',[]);
axis([0 150 0 150 -1.5 1.5])
for i = 1:numframes
pp = (zz.*(i/numframes)) + (zz2.*(1-(i/numframes)));
surfc(pp), colormap('cool');
FF(i)= getframe;
end
pause;
movie2avi(FF,'contoured2.avi', 'quality', 100)

All Comments (1)