How to draw two plots in one figure?
3 次查看(过去 30 天)
显示 更早的评论
Hi everyone.
I have two plots like this:


I want to have two plots in one figure like this in matlab. But I dont know what to do. please help me Thanks alot..

When I use this commands:
plot(x,y1);
hold on;
plot(x,y2);
hold off;
The result is as follow:

Becaues the values of y in two plots are different.
0 个评论
采纳的回答
更多回答(1 个)
Abhijit Nayak
2022-5-31
From my understanding, you are looking for a way to have two plots in one figure with a common x-axis. You can use “yyaxis” function for such scenario.
For further reference, you can refer to the following MATLAB documentation link- .
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Annotations 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!