Filter löschen
Filter löschen

How I can draw two animated plots on one plot at the same time with different colours to compare them online?

2 Ansichten (letzte 30 Tage)
I want to add another animated line (0.4^i) to the current figure with blue line to compare them online in one figure. How is it possible?
AnimL = animatedline;
for i=1:111
axis([0 i -1 1])
addpoints(AnimL,i, 0.5^i)
AnimL.Color = 'red';
drawnow limitrate
end

Akzeptierte Antwort

Voss
Voss am 8 Jan. 2024
AnimL = animatedline('Color','r');
AnimL2 = animatedline('Color','b');
for i=1:111
axis([0 i -1 1])
addpoints(AnimL,i, 0.5^i)
addpoints(AnimL2,i, 0.4^i)
drawnow limitrate
end
  1 Kommentar
Voss
Voss am 8 Jan. 2024
Another way:
AnimL = [animatedline('Color','r'), animatedline('Color','b')];
for i=1:111
axis([0 i -1 1])
addpoints(AnimL(1),i, 0.5^i)
addpoints(AnimL(2),i, 0.4^i)
drawnow limitrate
end

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Kategorien

Mehr zu Animation finden Sie in Help Center und File Exchange

Tags

Produkte


Version

R2022b

Community Treasure Hunt

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

Start Hunting!

Translated by