动图有gif格式和视频的avi格式. 1.sin(x)动图 clear all h = animatedline;%动画线 axis([0 4*pi -1 1]) box on x = linspace(0,4*pi,200); for k = 1:length(x) y = sin(x(k)); addpoints(h,x(k),y);%将数据添加到动画线中 drawnow%画出动画线 f=getframe(gcf); imind=frame2im(f); [imind,cm] = rgb2i