How to create animation ?
11 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
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 commentaires
Réponses (1)
Image Analyst
le 22 Déc 2018
See attached demo where I make a movie from different frames of surf() - the surface is changing in time.
0 commentaires
Voir également
Catégories
En savoir plus sur Animation 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!