how to draw two graphs on same figure in matlab
1 次查看(过去 30 天)
显示 更早的评论
i want to compare two graph for this i need to draw both on same figure.how can i do this?
0 个评论
回答(2 个)
sixwwwwww
2013-12-7
x1 = 0:10;
y1 = randi(100, 1, numel(x1));
x2 = 0:100;
y2 = randi(100, 1, numel(x2));
plot(x1, y1, x2, y2)
2 个评论
Wayne King
2013-12-7
编辑:Wayne King
2013-12-7
Have you tried simply hold on;
x = randn(100,1);
y = randn(100,1);
plot(x); hold on;
plot(y,'r');
Or simply:
plot(1:length(x),x,1:length(y),y)
If you need different scales for the y-axis see plotyy()
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Two y-axis 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!