Plot different functions in the same graph?

5 ビュー (過去 30 日間)
Davide Cardi
Davide Cardi 2019 年 3 月 18 日
編集済み: Davide Cardi 2019 年 3 月 18 日
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 Center および File ExchangeGraphics Performance についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by