Plot set of lines in Matlab -


I have a matrix with set points, which is divided into groups of 10 (examples given below). Each group of points corresponds to one line; How can I plot all the rows?

An example of how the matrix is ​​organized:

  y = [109.41 110.55 111.69 112.83 113.96 115.10 116.24 117.37 118.51 119.65 56.87 56.21 55.55 54.8 9 54.23 53.57 52.91 52.25 51.5 50.92 -265.16 -263.07-260.99 -258.90 -256.81 -254.73 -252.64-250.55 -248.47-246.38];  

I am using code to create this matrix and am trying to plot all the rows:

  for the point = ( 1: n) for point = (1:10) y (line, point) = [y (line) - point * sin (omega (line))]; End end plot (0: 1000, y, 'linewidth', 2)  

I I'm not surprised that you have an error with the code you used. Size (0: 1000) is 1x1001 . What is the size of your matrix y ?

With the data you provided, I will use the following:

  y = [109.41 110.55 111.69 112.83 113.96 115.10 116.24 117.37 118.51 119.65; ... 56.87 56.21 55.55 54.89 54.23 53.57 52.91 52.25 51.5 50.92; ... -265.16 -263.07-260.99 -258.90 -256.81 -254.73 -252.64-250.55 -248.47-246.38]; Plot (0: 100: 900, y, 'linewidth', 2)% size (0: 100: 900) is 1x10 and size (y) is 3x10 so we are good  

Returns the following results (in Octave, exactly the same thing in MATLAB):

Enter image Details here


Comments