How to create animation ?
2 ビュー (過去 30 日間)
古いコメントを表示
I have written a code to solve differential equation of a simple pendulum. I tried creating animation of the same. But I am not getting properly. Please correct me.
clear all
close all
clc
%let theeta=y
L=1;
t=[0 20];
yo=[0 3];
[t,y]=ode45('simplependulum',t,yo)
figure(1)
plot(t,y(:,1))
xlabel('time')
ylabel('displacement')
figure(2)
plot(t,y(:,2))
xlabel('time')
ylabel('angular velocity')
O=[0 0];
axis(gca,'equal');
axis([-0.7 0.7 -0.7 0.2]);
grid on;
figure(3)
for i=1:length(t)
P=L*[sin(y(i,1)) -cos(y(i,1))]
O_circle=viscircles(O,0.01);
pend=line([O(1) P(1)],[O(2) P(2)]);
ball=viscircles(P,0.05);
pause(0.001);
if i<length(t)
delete(pend);
delete(ball);
delete(O_circle);
end
end
0 件のコメント
回答 (1 件)
Image Analyst
2018 年 12 月 22 日
See attached demo where I make a movie from different frames of surf() - the surface is changing in time.
0 件のコメント
参考
カテゴリ
Help Center および File Exchange で Animation についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!