用Matlab做画星形线(astroid)的动画

2024-12-23 02:21:51
推荐回答(1个)
回答1:

matlab里的动画和你的是有些区别的:
clear all;clc;
a=4;
t=0:pi/150:2*pi;
xx=4*cos(t);
yy=4*sin(t);
plot(xx,yy);
hold on;
for k=1:length(t)
x=a*cos(t(k))^3;
y=a*sin(t(k))^3;
plot(x,y,'r.','Markersize',5);
axis([-5,5,-5,5]);
axis equal;
w(:,k)=getframe;
end
movie(w,5,200);