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 CenterFile Exchange에서 Images에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by