Effacer les filtres
Effacer les filtres

Plotting separate points on the same graph while your program is running

7 vues (au cours des 30 derniers jours)
Ivan
Ivan le 17 Jan 2012
Hi everyone,
I would like to find out if anyone knows how to plot points on a graph while the program is executing...
I have a for loop and each value of j gives me a different value of r. At the end of it, i would like to plot r (x-axis) against j (y-axis).
For example,
for j=1:5
%processes to find r..
r = %a certain value;
end
plot (r,j);
i cant seem to be able to get it done..

Réponse acceptée

Héctor Corte
Héctor Corte le 17 Jan 2012
Try this code:
for j=1:5
%processes to find r..
r = %a certain value;
plot (r,j);
%plot must be inside the loop or you onlye get one value of j and r.
hold on
%with this every new point adds to current graph instead of deleting it.
end
  1 commentaire
Ivan
Ivan le 18 Jan 2012
Hi Hector, one more thing, how do I draw a line through all the points?

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur 2-D and 3-D Plots dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by