How to plot multiple lines in a graph?
조회 수: 698 (최근 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!
댓글 수: 2
DGM
2025년 11월 9일 15:45
편집: DGM
2025년 11월 9일 16:18
Otherwise, I'd call this an unanswerably vague question.
There are already two answers for ways to plot multiple paired sets of x,y data, but x and y don't need to be vectors. They can be matrices, and there are multiple ways that they might be used. If or how that applied to the original problem is completely unknown. The documentation has examples.
답변 (3개)
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
댓글 수: 0
MathWorks Support Team
2019년 5월 22일
Please see the following post, which has a good accepted answer to a similar question:
댓글 수: 0
MAY THEE PHYU AUNG
2025년 11월 8일 11:06
x = linspace(0,10,100)
y = x.^2 .* exp(-x)
yd = 2*x .* exp(-x) - x.^2 .* exp(-x)
plot(x,y,'-o','LineWidth',2.2,'MarkerSize',7 ,x,yd,':s','LineWidth',2.2,'MarkerSize',7)
댓글 수: 0
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!