MATLAB Answers

how to make a single plot with different colors?

Asked by Arun Badigannavar on 17 Apr 2013
x=1:10;
y=1:10;
plot(x,y)
How to make one color from 1 to 5 ,,,and 6 to 10 another plot?

  0 Comments

Tags

Products

No products are associated with this question.

1 Answer

Answer by Iman Ansari
on 17 Apr 2013
 Accepted answer

Hi

x=1:10;
y=1:10;
plot(x(1:5),y(1:5),'r')
hold on
plot(x(5:10),y(5:10),'g')

  0 Comments


Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply today