Borrar filtros
Borrar filtros

How to plot a single collection of points

71 visualizaciones (últimos 30 días)
Zach Norris
Zach Norris el 18 de Abr. de 2017
Comentada: Michael el 24 de Oct. de 2023
I have only been using Matlab for a month or so, so I don't really know much. I have a single collection of points where I am storing the x and y coordinates as pairs.
The points: X = {[1; 1], [1; 4], [4; 4], [4; 1]};
All I want to know is how I plot this, it seems simple, but I haven't had any luck. Thanks in advance.

Respuesta aceptada

Andrew Newell
Andrew Newell el 18 de Abr. de 2017
You need to separate the x and y coordinates. Here is one solution:
data = [X{:}];
xdata = data(1,:); ydata = data(2,:)
plot(xdata,ydata,'-*')
axis([0.9 4.1 0.9 4.1])
I have modified the axes because otherwise you can't see the lines for the axes.

Más respuestas (0)

Categorías

Más información sobre Two y-axis 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