MATLAB Answers

0

plot columns of matrix

Asked by Filip Jackowski on 1 May 2019
Latest activity Edited by Geoff Hayes
on 1 May 2019
suppose I have a 4x100 matrix Ctrack. The four rows each correspond to a different variable, and they change with time from one column to the next. How would I plot it so that on the same plot i have four different curves showing how each variable changes across the different columns?

  0 Comments

Sign in to comment.

Products

1 Answer

Geoff Hayes
Answer by Geoff Hayes
on 1 May 2019
Edited by Geoff Hayes
on 1 May 2019

Filip - from plot,
plot(Y) creates a 2-D line plot of the data in Y versus the index of each value.
...
If Y is a matrix, then the plot function plots the columns of Y versus their row number. The x-axis scale ranges from 1 to the number of rows in Y.
In your case, you want to plot the rows of Y versus their column number. So perhaps try transposing the data and do as
plot(Ctrack');

  0 Comments

Sign in to comment.