fitting a histogram with Gaussian and getting best fit data for mean and st dev from the fitted curve
26 views (last 30 days)
Show older comments
Stephen on 7 Jan 2019
Commented: Rik on 7 Jan 2019
I'm trying to obtain the mean (mu) and stand dev (sigma) for a Gaussian curve drawn to fit the histogram of a data set (see attached, "histogram sample.xlsx). I can generate a histogram with Guassian curve using, for instance,
>> pd = fitdist(x,'Normal')
mu = 0.0266749 [0.0162315, 0.0371183]
sigma = 0.0945052 [0.0876766, 0.102496]
However, those values (mu, sigma) appear to be the values for the underlying complete data set, NOT for the Gaussian fit. The mean, stand deviation for the Gaussian fit are smaller, of course. Question: how to extract the mu and sigma for the fitted curve instead of the raw data.
For example, Graphpad Prism (a convenient statistics software) also gives mu = 0.0266749 and sigma = 0.0945052 for the same dataset:
Graphpad also fits a Gaussian and provies a best fit values for mu and sigma for the fitted curve, mu = 0.006117 and sigma = 0.04694:
I'd like to be able to extract these same data (best fit values) using MatLab but I don't know how to. Any help?
Rik on 7 Jan 2019
If you have x-y data, you can fit it to the Gaussian function:
Find more on Half-Normal Distribution in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!Start Hunting!