Borrar filtros
Borrar filtros

simple plot question (:,1)

12 visualizaciones (últimos 30 días)
Daniel
Daniel el 21 de Abr. de 2013
im currently revising my matlad university course and although i understand the majority of code i strugle when it come to plotting. the main question is when to use
plot(y(:,1),y(:,2),'r');
i cannot figure out what the difference is if i do not use (:,1) or what this means exactly?
any help much appriciated

Respuesta aceptada

Chandra Shekhar
Chandra Shekhar el 21 de Abr. de 2013
Editada: Randy Souza el 22 de Abr. de 2013
Here your y is having two columns and many rows.
Here you are considering y(:,1) in x-axis and y(:,2) in y-axis in the plot.
If you use plot(y,'r'), then two column will plot in y-axis and x-axis will be some random value.
if you want more clear idea in plotting just check this different plots.
y=rand(10,2);
plot(y(:,1),'r');
plot(y(:,2),'r');
plot(y,'r');
x=1:10; % here x-axis assumed from 1 to 10
plot(x,y,'r');
plot(x,y(:,1),'r');
plot(x,y(:,2),'r');

Más respuestas (0)

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