how to plot multiple curves in the same figure

Hello everyone I'm new in matlab and I want to know how can I plot multiple curves in the same figure knowing that every single curve has it's own expression(function).Do I have to write the code for every single function in has own file?? any idea please and thanks

 채택된 답변

KSSV
KSSV 2017년 10월 31일
편집: KSSV 2017년 10월 31일
Use hold on
figure
hold on
plot(rand(10,1),'r')
plot(rand(10,1),'b')
plot(rand(10,1),'g')
legend('data1','data2','data3')

추가 답변 (2개)

M
M 2017년 10월 31일

0 개 추천

Have a look at the hold on function
geofo
geofo 2021년 12월 3일
편집: geofo 2021년 12월 3일
plot([rand(10,1), rand(10,1), rand(10,1)])
legend('data1','data2','data3')
Use colororder before calling plot to have your prefered colors.
The vectors v1, v2, v3, in plot([v1, v2, v3]) must be column vectors, all with the same dimension

카테고리

도움말 센터File Exchange에서 Creating, Deleting, and Querying Graphics Objects에 대해 자세히 알아보기

제품

태그

질문:

2017년 10월 31일

편집:

2021년 12월 3일

Community Treasure Hunt

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

Start Hunting!

Translated by