Borrar filtros
Borrar filtros

matlab plot 2 vectors

39 visualizaciones (últimos 30 días)
joo
joo el 4 de Oct. de 2012
hello!
i have X and Y data. if i plot it i get an open curve, but want to obtain a closed curve and so i do
XX=[X(end) X];
YY=[Y(end) Y];
plot(XX,YY,'r-')
is there a more elegant way to do it? i can't find a better solution...
thank you so much!

Respuesta aceptada

Image Analyst
Image Analyst el 4 de Oct. de 2012
I don't see anything wrong with that unless you'd want to do it all in one line to prevent creating temporary variables, but the variables are so tiny (just a few hundred coordinates in these days of gigabyte RAM) it's really not worth worrying about.
plot([X(end) X], [Y(end) Y], 'r-');

Más respuestas (1)

Azzi Abdelmalek
Azzi Abdelmalek el 4 de Oct. de 2012
Editada: Azzi Abdelmalek el 4 de Oct. de 2012
not different from yours
plot([x x(1)],[y y(1)],'r-')
  3 comentarios
joo
joo el 4 de Oct. de 2012
i didn't understand. i mean, i close the curve with the code i posted... thank you so much
joo
joo el 4 de Oct. de 2012
thank you

Iniciar sesión para comentar.

Categorías

Más información sobre 2-D and 3-D Plots en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by