Curve Fitting on Histogram

7 次查看(过去 30 天)
Ahmed Ismail
Ahmed Ismail 2016-9-29
评论: dbmn 2016-9-29
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
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?
dbmn
dbmn 2016-9-29
data = data./max(data)
should normalize your data. Maybe check first if max(data)>0 :)

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Interpolation 的更多信息

产品

Community Treasure Hunt

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

Start Hunting!

Translated by