Is there a way to do a multi normal distribution fitting in Matlab?

4 views (last 30 days)
I have a set of data with multi normal distribution. How can I do a distribution fitting in matlab to identify the mean and sigma for each one? Please see an example in JMP in the picture. Thank you so much for the help!
Screen Shot 2019-10-30 at 6.18.17 PM.png

Accepted Answer

Jeff Miller
Jeff Miller on 31 Oct 2019
The sigma isn't really off. GMModel.Sigma is variance = sigma^2

More Answers (1)

Jeff Miller
Jeff Miller on 31 Oct 2019
  1 Comment
Yan Guan
Yan Guan on 31 Oct 2019
Thank you for the answer. I was trying to use this for the fitting. Below are the commands I have tried.
%create a 2 component, 1 variable distribution
mu1 = -5;
mu2 = 2;
sigma1 = 1;
sigma2 = 0.5;
X = [normrnd(mu1,sigma1,[1000,1]);normrnd(mu2,sigma2,[1000,1])];
% use fitgmdist for the fitting
GMModel = fitgmdist(X,2);
% check the fitting result: mu and sigma
GMModel.mu
GMModel.Sigma
MModel.mu
ans =
1.9923
-5.0686
GMModel.Sigma
ans(:,:,1) =
0.2436
ans(:,:,2) =
1.0688
The result for the mu looks right, but the Sigma is off. I tried to understand why there is the difference. Really appreciate if anyone can help!

Sign in to comment.

Community Treasure Hunt

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

Start Hunting!