如何用matlab将一组数据绘制成动态曲线,下面代码是绘制动态圆函数曲线,如何用数据代替?附件是想要的效果。
14 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
华纳娱乐开户电话【微8785092】
le 20 Mai 2023
Réponse apportée : 华纳娱乐开户【微8785092】
le 20 Mai 2023
%% 1. 动态绘制圆
T = linspace(0,2*pi,100)';
X = cos(T);
Y = sin(T);
figure
F = MovieXY(X,Y); % 绘制动态曲线
Fun_F2gif(F,'Test1.gif',0.01); % 生成gif图片
0 commentaires
Réponse acceptée
华纳娱乐开户【微8785092】
le 20 Mai 2023
做一个示例程序:
x = linspace(0,4*pi,100);
y = sin(x);
h = plot(x(1),y(1));
axis([0,4*pi,-1,1])
filename = '动画示例.gif';
f = getframe(gcf);
IM = f.cdata;
[IM,map] = rgb2ind(IM,256);
imwrite(IM,map,filename,'gif', 'Loopcount',inf,'DelayTime',0.2);
for k = 2:length(x)
set(h,'XData',x(1:k),'YData',y(1:k));
drawnow
f = getframe(gcf);
IM = f.cdata;
[IM,map] = rgb2ind(IM,256);
imwrite(IM,map,filename,'gif','WriteMode','append','DelayTime',0.2);
pause(0.2);
end
0 commentaires
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Resizing and Reshaping Matrices dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!