アニメーションとしての保存方法
5 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
comet(a,b)
でアニメーション動画を出したものをaivで保存したいのですが、分かる方教えて頂きたいです。 helpも見てみたのですが、 matlab初心者なので、複雑でよく分からなかったです。 宜しくお願い致します。
0 commentaires
Réponse acceptée
Kenta
le 12 Juin 2020
clear;clc;close all
t = 0:.01:pi;
x = cos(2*t).*(cos(t).^2);
y = sin(2*t).*(sin(t).^2);
figure;plot(x,y);hold on
filename = 'testAnimated.gif';
for i=1:numel(x)
scatter(x(i),y(i),'r')
frame = getframe(gcf);
im = frame2im(frame);
[A,map] = rgb2ind(im,256);
if i == 1
imwrite(A,map,filename,'gif','LoopCount',Inf,'DelayTime',.01);
else
imwrite(A,map,filename,'gif','WriteMode','append','DelayTime',.01);
end
end
できるのかもしれませんが、comet関数の途中で止めたり保存したりすることは難しい気がします。for文で各tの値でプロットしながら保存するのはいかがでしょうか。上は表示のためGIFですが、AVI形式も可能です。
0 commentaires
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur アニメーション 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!