Clear Filters
Clear Filters

How to use the fitting curve of a histogram?

1 view (last 30 days)
Wenlong
Wenlong on 26 Oct 2012
Hi, all
I am using histfit to find a fitting curve to my histogram. According to the observation, it should be gaussian.
As I look into the help of matlab, it says that histfit returns a vector which contains handles to the histogram and the density curve. My question is, how to use the handle to get access to the density curve? And how can I get access to the variance of the fitting curve?
Thank you very much for any help.
Best regards Wenlong

Answers (1)

Wayne King
Wayne King on 26 Oct 2012
If you think that a Gaussian distribution provides a good fit, you can use normfit() with your data to get the estimates of mu and sigma. For example:
X = randn(100,1)+2;
[muhat,sigmahat] = normfit(X);

Community Treasure Hunt

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

Start Hunting!