plot and hist in matlab

please anybody answer me How can I get two plot in one graph using bar or hist or plot
and how can I use ((hold and grid command)) with plot and hist
Thanks in advance

 採用された回答

Matt Fig
Matt Fig 2011 年 4 月 7 日

1 投票

Two histograms:
x = -2.9:0.1:2.9;
y = randn(10000,1);
hist(y,x)
h = findobj(gca,'Type','patch');
set(h,'FaceColor','r','EdgeColor','w')
z = randn(size(y))/3;
hold on % make sure next one shows up.
hist(z,x)

5 件のコメント

reem
reem 2011 年 4 月 7 日
Thank you Matt and sorry for bothering you
when I apply this manner,only one line appear on the graph
I have two value,one value(estimated and another true)
and I want to plot tow these values in the same graph and when I used your manner only one line appeared on the graph,what is the problem?
Matt Fig
Matt Fig 2011 年 4 月 7 日
Did you copy and paste the above code completely?
reem
reem 2011 年 4 月 7 日
Yes,but I changed some variables to run my program
x = -2.9:0.1:2.9;
hist(proestimated,x)
h = findobj(gca,'Type','patch');
set(h,'FaceColor','r','EdgeColor','w')
hold on
hist(True_probability,x)
Matt Fig
Matt Fig 2011 年 4 月 7 日
Does the second hist cover up the first? Try hist(True_probability,x) first, then doing hist(proestimated,x).
reem
reem 2011 年 4 月 7 日
I do that but nothing is changed
the same result appeared

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

その他の回答 (0 件)

カテゴリ

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

タグ

質問済み:

2011 年 4 月 7 日

Community Treasure Hunt

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

Start Hunting!

Translated by