Plot different functions in the same graph?

5 Ansichten (letzte 30 Tage)
Davide Cardi
Davide Cardi am 18 Mär. 2019
Bearbeitet: Davide Cardi am 18 Mär. 2019
Hi,
I would like to plot three function . Is there a way I can fix two of them (in the background) and make the other change every 1 second (for example)?
I mean, if I use "hold on" every second one graphic is added and if I don't use it the ones in the background get delete; I would like to change only one of them.
How should I do?

Akzeptierte Antwort

Walter Roberson
Walter Roberson am 18 Mär. 2019
plot first function
hold on
plot second function
h3 = plot third function
for t = 1 : whatever
calculate new X and Y to plot
set(h3, 'XData', new_X, 'YData', new_Y);
drawnow();
pause(time_interval_goes_here)
end
That is, record the returned handle of the plot you want to change, and inside the loop update the properties of that handle instead of making a new plotting call.

Weitere Antworten (0)

Kategorien

Mehr zu Graphics Performance finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by