필터 지우기
필터 지우기

Matlab shows the histogram 3 times!

조회 수: 1 (최근 30일)
Tala Hed
Tala Hed 2017년 1월 13일
댓글: Wilson A N 2017년 1월 16일
I curve fit 4 distributions over a histogram. Each time that I use histfit command, it shows the corresponding histogram as well and at the end I have repetitive legends! Can any one help how to get rid of the redundant ones? The code is pretty simple!
sz=xlsread('sz418.xlsx');
mm=sz(:,1);
aa=sz(:,2);
k=histfit(mm,10,'normal')
hold on
h=histfit(mm,10,'inversegaussian')
h(2).Color = [.8 .2 .8];
p=histfit(mm,10,'lognormal')
p(2).Color = [.1 .1 .1];
pd = makedist('Normal',mean(mm),std(mm));
t = truncate(pd,0,1.2)
x = 0:.01:0.5;
plot(x,10*pdf(t,x),'Color','blue','LineWidth',2,'LineStyle',':')
hold off
  댓글 수: 1
Wilson A N
Wilson A N 2017년 1월 16일
I tried running this code but didn't get the error. Initially I didn't even get the legend. I had to manually force it to appear by writing the the legend('show') command at the end of the above code. May be some of the options in the documentation link below may help
https://www.mathworks.com/help/matlab/ref/legend.html

댓글을 달려면 로그인하십시오.

답변 (0개)

카테고리

Help CenterFile Exchange에서 Histograms에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by