Borrar filtros
Borrar filtros

Unable to plot 2 columns of a matrix against each other

2 visualizaciones (últimos 30 días)
Hello, I have a 466x2 matrix and I am trying to plot column 1 on the x-axis and column 2 on y. For that, I am trying the following:
I have the matrix antenna1 as
Column 1 Column 2
0.047393 2530
0.047393 2529
0.097389 2513
0.097389 2491
0.147392 2462
0.147392 2423
0.19739 2387
0.19739 2353
0.247396 2328
0.247396 2310 .... and so on
I am plotting the graph using:
figure
hold on
plot(antenna1(:,1),antenna1(:,2))
I get the following graph for this:
This graph shows both lines plotted on the y-axis. I want column 1 on x and column 2 on y.
How do I achieve this?
Thanks for any help.
Pranav

Respuesta aceptada

KSSV
KSSV el 6 de Dic. de 2016
Try
n = 1 ; % play around with n
plot(antenna1(1:end-n,1),antenna1(1:end-n,2))
  1 comentario
Pranav Thiagarajan
Pranav Thiagarajan el 6 de Dic. de 2016
Thank you. It was due to extra pre-initialised rows and columns that were set to 0.

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Line 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