Fit a histogram and normal distribution to data

8 ビュー (過去 30 日間)
Jurgen Casha
Jurgen Casha 2017 年 3 月 10 日
回答済み: Niels8 2019 年 12 月 17 日
I have the following variable:
The numbers on the left column represent the bin edges and the numbers on the right column represent the percentage frequency of the bin. For example:
(>1400 = 0%) and (between 1000 and 1400 = 1.1961%) and (between 710 and 1000 = 2.26725%) and so on.
I would like to construct a histogram and a probability density function (I think a gaussian curve fits well).
The problem is that I do not know the exact code for this and that the bins are not all the same size.
  1 件のコメント
Mathieu Montoya
Mathieu Montoya 2017 年 5 月 24 日
did you try histfit ?

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

回答 (2 件)

Niels8
Niels8 2019 年 12 月 17 日
Did anyone find the question to this?
I am having the same problem

Image Analyst
Image Analyst 2017 年 3 月 10 日
Use fitdist(). The example in the help is:
%%Fit a Normal Distribution to Data
% Copyright 2015 The MathWorks, Inc.
Load the sample data. Create a vector containing the patients' weight data.
load hospital
x = hospital.Weight;
Create a normal distribution object by fitting it to the data.
pd = fitdist(x,'Normal')
Plot the pdf of the distribution.
x_values = 50:1:250;
y = pdf(pd,x_values);
plot(x_values,y,'LineWidth',2)
  2 件のコメント
Jurgen Casha
Jurgen Casha 2017 年 3 月 12 日
the value of x only accepts the raw data. The problem is that i only know ranges of data. For example in this case between 0 and 75 there is 0.0194%.
Image Analyst
Image Analyst 2017 年 5 月 25 日
You can use the count values of your histogram bins for x. The "x_values" would be the values of the histogram bin centers.

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

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by