How to use the fitting curve of a histogram?

1 次查看(过去 30 天)
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

回答(1 个)

Wayne King
Wayne King 2012-10-26
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!

Translated by