How to plot multiple lines in a graph?

조회 수: 2,068 (최근 30일)
zephyr21
zephyr21 2016년 6월 24일
답변: Mpilo Hlwathika 2023년 6월 12일
I have a matrix with several 5 layers. I want to plot the numbers at a specific gridpoint for layers 2,3, and 4. How would I go about doing this?
Thanks for the help!
  댓글 수: 1
Stephen23
Stephen23 2016년 6월 25일
편집: Stephen23 2016년 6월 25일
@zephyr21: please upload your code here on this forum by editing your question and clicking the paperclip button. Make sure to include any data that is required to run the code.

댓글을 달려면 로그인하십시오.

답변 (3개)

Muhammad Usman Saleem
Muhammad Usman Saleem 2016년 6월 24일
x1=[2 3 4 5];
y1=[9 4 3 2];
x2=[11 20 30 50 ];
y2= [ 20 30 50 60];
plot(x1,y1)
hold on
plot(x2,y2)
hold off
This plot two line graphs on same plot

Mpilo Hlwathika
Mpilo Hlwathika 2023년 6월 12일
x1=[2 3 4 5];
y1=[9 4 3 2];
x2=[11 20 30 50 ];
y2= [ 20 30 50 60];
plot(x1,y1)
hold on
plot(x2,y2)
hold off

MathWorks Support Team
MathWorks Support Team 2019년 5월 22일
Please see the following post, which has a good accepted answer to a similar question:

카테고리

Help CenterFile Exchange에서 2-D and 3-D Plots에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by