Plot different functions in the same graph?

5 次查看(过去 30 天)
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?

采纳的回答

Walter Roberson
Walter Roberson 2019-3-18
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.

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Graphics Performance 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by