MATLAB Answers

How to plot multiple lines in a graph?

5,908 views (last 30 days)
zephyr21 on 24 Jun 2016
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 Comment

Stephen Cobeldick
Stephen Cobeldick on 25 Jun 2016
@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.

Sign in to comment.

Answers (2)

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


Sign in to comment.

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


Sign in to comment.

Community Treasure Hunt

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

Start Hunting!

Translated by