So I'm currently attempting to animate multiple graphs on the same page using the comet() funtion, but when I run the functions together, they run one after the other,
each graph is modelled similarly but I'd like to have them all run simultaneously on the same graph. Is that possible for a comet() function?
x = a+b*cos(3*pi*t);
y = b+c*sin(3*pi*t);
plot(x,y);
comet(x,y);
hold on

 Réponse acceptée

Ameer Hamza
Ameer Hamza le 9 Mai 2020
Try this example
h1 = animatedline('Color', 'r');
h2 = animatedline('Color', 'b');
x1 = linspace(0, 10, 100);
x2 = linspace(0, 10, 100);
y1 = sin(x1);
y2 = cos(x2);
axis([0,10,-1,1])
for k = 1:length(x1)
addpoints(h1,x1(k),y1(k));
addpoints(h2,x2(k),y2(k));
drawnow
end

Plus de réponses (0)

Catégories

En savoir plus sur Animation dans Centre d'aide et File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by