Plot different functions in the same graph?
5 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Davide Cardi
el 18 de Mzo. de 2019
Editada: Davide Cardi
el 18 de Mzo. de 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?
0 comentarios
Respuesta aceptada
Walter Roberson
el 18 de Mzo. de 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.
0 comentarios
Más respuestas (0)
Ver también
Categorías
Más información sobre Graphics Performance en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!