How to plot four variables value in XY graph

How to plot set of values like(x,y),,,,x=1:1:10 ,,,,,y=1:1:10,,,, and (x1,y1),,,x1=:30:1:40,,,,y1=30:1:40,,,,,in a single plot and my plot should plot one by one value,,,, It is something like two vehicles at two different postion and they are moving with step increment of one by one

1 comentario

richa parmar
richa parmar el 31 de Ag. de 2019
how to plot four variables in a single graph on mATLAB

Iniciar sesión para comentar.

 Respuesta aceptada

Muruganandham Subramanian
Muruganandham Subramanian el 7 de Dic. de 2012

0 votos

plot(x,y,'r*',x1,y1,'b-')

5 comentarios

Arun Badigannavar
Arun Badigannavar el 7 de Dic. de 2012
Thanks,,, and am taking these values from two defferent simulink models ,so my plot is coming after complete execution of simulink models,,,can i plot step by step,,,I mean one x,y ,x1,y1 value is calculated and i should plot it,and for second set of values it should plot,,,I mean to say i don want to wait for all set of data to come into workspace and then plot ,,how to plot continuously
Do you need this:
x=1:1:10
y=1:1:10
for i=1:10
hold on
plot(x(i),y(i),'r*')
end
Arun Badigannavar
Arun Badigannavar el 7 de Dic. de 2012
for these given x values it works,,,but i have these four variables values coming from simulink models,,,so can i plot simulink model values step by step
Muruganandham Subramanian
Muruganandham Subramanian el 7 de Dic. de 2012
Editada: Muruganandham Subramanian el 7 de Dic. de 2012
If the output values from simulink model is present in base workspace, it'll work
Arun Badigannavar
Arun Badigannavar el 7 de Dic. de 2012
I got it,,,assigned the values and plotting it,,,thanks for ur help

Iniciar sesión para comentar.

Más respuestas (1)

Harshit
Harshit el 7 de Dic. de 2012

0 votos

use hold all after first plot.

1 comentario

Arun Badigannavar
Arun Badigannavar el 7 de Dic. de 2012
for these given x values it works,,,but i have these four variables values coming from simulink models,,,so can i plot simulink model values step by step

Iniciar sesión para comentar.

Categorías

Más información sobre Creating, Deleting, and Querying Graphics Objects en Centro de ayuda y File Exchange.

Productos

Community Treasure Hunt

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

Start Hunting!

Translated by