返回信息流x=0:0.1:20;
y=1-1/sqrt(1-0.3^2)*exp(-0.3*x).*sin(sqrt(1-0.3^2)*x+acos(0.3));
plot(x,y);
h=line(0,0,'color','red','marker','.','markersize',40,'erasemode','xor');
for i=1:length(x)
set(h,'xdata',x(i),'ydata',y(i));
pause(0.005);
drawnow;
end
这是一条镜像帖。来源:北邮人论坛 / matlab / #5129同步于 2009/4/13
该镜像源已超过 30 天没有更新,可能在源站已被删除。
Matlab机器人发帖
一段动画
ltx1215
2009/4/13镜像同步5 回复
订阅后,新回复会通过你的通知中心匿名送达。
5 条回复
【 在 luntan 的大作中提到: 】
: 使用pause和plot做动画确实是个很简单使用的方法
顺便问一下版主 用pol2cart 做极坐标转化到x,y坐标后 怎么做插值处理呢 比如这个程序
theta=0:pi/18:35*pi/18;%角度
r0=[0 0.02 0.09 0.19 0.31 0.46 0.57 0.67 0.74 0.77 0.74 0.66 0.54 0.44 0.33 0.20 0.09 0.02 0 0.02 0.09 0.2 0.33 0.45 0.55 0.65 0.70 0.72 0.72 0.68 0.57 0.43 0.30 0.18 0.09 0.02 ];
r20=[0.10 0.14 0.20 0.28 0.36 0.46 0.54 0.60 0.67 0.69 0.66 0.59 0.50 0.41 0.31 0.22 0.15 0.11 0.10 0.13 0.19 0.27 0.37 0.48 0.56 0.64 0.68 0.67 0.62 0.59 0.52 0.43 0.32 0.22 0.15 0.11 ];
r45=[0 0.04 0.11 0.23 0.35 0.48 0.57 0.66 0.69 0.71 0.70 0.64 0.53 0.39 0.26 0.14 0.07 0.01 0 0.04 0.12 0.22 0.34 0.48 0.59 0.68 0.74 0.75 0.72 0.63 0.49 0.40 0.27 0.17 0.07 0.01 ];
polar(theta,r0);
hold on
polar(theta,r20);
hold on
polar(theta,r45);
end
唔。。不会。。。
【 在 ltx1215 的大作中提到: 】
: 顺便问一下版主 用pol2cart 做极坐标转化到x,y坐标后 怎么做插值处理呢 比如这个程序
: theta=0:pi/18:35*pi/18;%角度
: r0=[0 0.02 0.09 0.19 0.31 0.46 0.57 0.67 0.74 0.77 0.74 0.66 0.54 0.44 0.33 0.20 0.09 0.02 0 0.02 0.09 0.2 0.33 0.45 0.55 0.65 0.70 0.72 0.72 0.68 0.57 0.43 0.30 0.18 0.09 0.02 ];
: ...................