how to draw two graphs on same figure in matlab

i want to compare two graph for this i need to draw both on same figure.how can i do this?

回答 (2 件)

sixwwwwww
sixwwwwww 2013 年 12 月 7 日

0 投票

x1 = 0:10;
y1 = randi(100, 1, numel(x1));
x2 = 0:100;
y2 = randi(100, 1, numel(x2));
plot(x1, y1, x2, y2)

2 件のコメント

Muhammad Aamir
Muhammad Aamir 2013 年 12 月 7 日
two different codes leach and modleach i want both on same graph
sixwwwwww
sixwwwwww 2013 年 12 月 7 日
can you show your codes for leach and modleach?

サインインしてコメントする。

Wayne King
Wayne King 2013 年 12 月 7 日
編集済み: Wayne King 2013 年 12 月 7 日

0 投票

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()

カテゴリ

ヘルプ センター および File ExchangeDiscrete Data Plots についてさらに検索

質問済み:

2013 年 12 月 7 日

コメント済み:

2013 年 12 月 7 日

Community Treasure Hunt

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

Start Hunting!

Translated by