clear;clc;
[x,y]=meshgrid(-8:.1:8);
for j=1:10
f=@(x,y)(sin(sqrt((11-j)*(x.^2+y.^2)))./sqrt((11-j)*(x.^2+y.^2)+eps));
z=f(x,y);
surf(x,y,z);
shading interp;
M(j) = getframe;
if j==1
[I,map]=rgb2ind(M(j).cdata,256);
imwrite(I,map,'out.gif','DelayTime',.1,'LoopCount',Inf) %gif图像无限循环
else
[I,map]=rgb2ind(M(j).cdata,256);
imwrite(I,map,'out.gif','WriteMode','append','DelayTime',0.1) %添加到图像
end
end
movie2avi(M,'out.avi')
msgbox('MATLAB编程答疑,请加QQ: 993878382','MATLAB答疑','help')
web http://993878382.qzone.qq.com -browser