PDA

View Full Version : Matlab - How to plot a matrix


Funzies
Apr13-11, 04:38 AM
Hey guys, I'm having some trouble plotting a matrix.
I have a cell in which I've put four matrices. These matrices are variable in length: they are nx2 with n starting on 31 and varying from 0 to 120. De first column of each matrix represents the x-coordinate and the second column represents the y-coordinate from a point.
I want to plot these four matrices pointwise and fit lines through them, each having a different colour. Can anyone help me with this code? I can't seem to find the way in the Matlab help browser..

jhae2.718
Apr13-11, 08:21 AM
For multiple plots, use
hold on;

To plot the matrices, for each matrix use something like
plot(matrix(1,:),matrix(2,:))

You should be able to find how to change line colors in the online MATLAB docs.

ChristinaJ
Apr14-11, 03:54 PM
hold all;

will plot each successive dataset in a different colour.