Hi, so I am trying to fit a polynomial curve on the histogram data, but I have problem in the implementation. I am using the function 'histfit' like so:
[j,qout] = hist(data,700);
h = histfit(data, 700, 'beta');
but it's coming with an error, stating:
All values must be within the closed interval [0,1].
I don't see such an implementation on the documentation of the function. Help would be much appreciated.

 채택된 답변

dbmn
dbmn 2016년 9월 29일

0 개 추천

Hi Ahmed,
if I use
data = rand(1e6,1);
it works flawlessly, but if I use
data = 2*rand(1e6,1);
I get the same error. As the error suggests, the function only works on Data Ranges [0,1].

댓글 수: 2

Ahmed Ismail
Ahmed Ismail 2016년 9월 29일
Ah, now I understand, so is there an alternative for values that exceed 1, or is it a simpler option just to normalise the histogram?
data = data./max(data)
should normalize your data. Maybe check first if max(data)>0 :)

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

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Histograms에 대해 자세히 알아보기

제품

질문:

2016년 9월 29일

댓글:

2016년 9월 29일

Community Treasure Hunt

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

Start Hunting!

Translated by