1个回答
展开全部
使用如下代码:
clear
clc
close all
figure;
filename='trace.gif';
x=linspace(0,10*pi,2000);
y=cos(x);
z=sin(x);
for i=1:2000
plot3(x(i),y(i),z(i),'-bo');
pause(0.1);
hold on;
F=getframe(gcf);
im=frame2im(F);
[I,map]=rgb2ind(im,256);
k=i-0;
if k==1;
imwrite(I,map,filename,'gif','Loopcount',inf, 'DelayTime',0.03);
else
imwrite(I,map,filename,'gif','WriteMode','append', 'DelayTime',0.03);
end
end
clear
clc
close all
figure;
filename='trace.gif';
x=linspace(0,10*pi,2000);
y=cos(x);
z=sin(x);
for i=1:2000
plot3(x(i),y(i),z(i),'-bo');
pause(0.1);
hold on;
F=getframe(gcf);
im=frame2im(F);
[I,map]=rgb2ind(im,256);
k=i-0;
if k==1;
imwrite(I,map,filename,'gif','Loopcount',inf, 'DelayTime',0.03);
else
imwrite(I,map,filename,'gif','WriteMode','append', 'DelayTime',0.03);
end
end
本回答被网友采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询