Can anyone debug the following code?

1 回表示 (過去 30 日間)
Jab
Jab 2016 年 8 月 12 日
コメント済み: Jab 2016 年 8 月 12 日
The code is given below. The problem I am facing is while bringing two plots together using hold on function the result is not the exact result what I am getting in the seperate window. variable K is attached. Thanks
figure,histogram(K);hold on;
pd= fitdist(K','Kernel');
x_values = -30:0.1:40;
y = pdf(pd,x_values);
plot(x_values,y,'LineWidth',2)

採用された回答

Bekay.Kang
Bekay.Kang 2016 年 8 月 12 日
becuase two plots have different y-axis scale! you have to modify y-axis scale!
%code
figure,hist(K);hold on;
pd= fitdist(K','Kernel');
x_values = -30:0.1:40;
y = pdf(pd,x_values);
plot(x_values,y*(max(hist(K))/max(y)),'r','LineWidth',2)
  1 件のコメント
Jab
Jab 2016 年 8 月 12 日
thanks for your answer. However my original histogram shrinks.

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeGraphics Object Programming についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by