How to plot multiple lines in a graph?

2,409 次查看(过去 30 天)
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
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

MathWorks Support Team
Please see the following post, which has a good accepted answer to a similar question:

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

类别

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