xiaobainjust
2007-08-31, 22:16
各位大虾:怎么在matlab中将曲线动态画出来,如t=0:1:2*pi;plot(t,sin(t)),让它慢慢地显示出来,我要做的飞机的飞行轨线,所以需要显示飞行过程。还有怎样可使曲线显示时加上飞机的图标,这样更形象一点。多谢啊
t=0:pi/100:2*pi;
y=sin(t);
plot(t,y);
h=line('color',[1 0 0],'marker','.','markersize',40,'erasemode','xor');
n=length(t);
for i=1:n;
set(h,'xdata',t(i),'ydata',y(i));
drawnow;
pause(0.005)
end
使用comet函数实现
t=0:0.001:2*pi;
y=sin(t);
comet(t,y)
vBulletin® v3.8.3,版权所有 ©2000-2025,Jelsoft Enterprises Ltd.