Plotting array elements in different colors

Hello,
Can someone explain how to plot the array elements in different colours I mean how to plot the array elements like from 1:500 in red color then 501:1000 in blue colour 1001:1500 in different colour.
Thankyou.

 채택된 답변

Azzi Abdelmalek
Azzi Abdelmalek 2014년 4월 8일

0 개 추천

x=1:1500;
y=rand(1,1500);
plot(x(1:500),y(1:500),'r')
hold on
plot(x(501:1000),y(501:1000),'b')
plot(x(1001:1500),y(1001:1500),'k')
hold off

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Surfaces, Volumes, and Polygons에 대해 자세히 알아보기

제품

질문:

2014년 4월 8일

답변:

2014년 4월 8일

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by