Reputation: 7367
I have a 1x400 vector, I want to draw each 80 elements in different color with plot
command, first 80 elements in blue, second 80 elements in green and so so.
Upvotes: 1
Views: 130
Reputation: 25140
The simplest way is to reshape the data so that you plot multiple columns simultaneously, like this:
x = 1:400;
y = x.^1.5;
plot(reshape(x,80,5), reshape(y,80,5))
If you need more control, you can either use the line
command, or plot with hold on
.
Upvotes: 4
Reputation: 74930
There's two ways to do this:
(1) Reshape your vector so that it's a 80-by-5 array and call plot
once
plot(reshape(yourVector,80,5))
(2) Use hold on
to make sure plots get added, not replaced
Upvotes: 3