
Using fitgmdist on a Histogram
7 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
I have a Histogram in which I want to find the peaks of a mixture of gaussians (see attached .fig file).
The Histogram shows 4 clear peaks of which I need to know the centres.
However, I can not get fitgmdist to properly fit gaussians. It does perform some kind of fit, but returns mu and Sigma with strange, impossible values!
I have also attached a MWE for reproducibilty.
I believe I am confused as to what the first argument to fitgmdist has to be.
This is a one dimensional problem, and Mathworks examples all deal with higher dimensional problems which I have difficulty to reduce.

0 Kommentare
Antworten (2)
Image Analyst
am 7 Dez. 2018
Fit the count data with fitnlm. I attach a demo for two Gaussians. Make the obvious adaptations for 4 Gaussians.

2 Kommentare
Image Analyst
am 11 Dez. 2018
Another option is to use the clean algorithm. The strategy astronomers use in finding stars is the "Clean" algorithm. Take largest peak, fit it, subtract from the data to get new data, and then iterate on all the smaller remaining peaks until you've gotten to peaks so small thatyou want to stop. I suppose it works okay empirically but I gotta think there's a fancier, mathematically accurate way. Though things are harder in 2-D - it's not just a straightforward extension of the 1-D case.
Try this link
Alfredo Dinho
am 26 Mai 2021
Hello my friend! You just have to transpose the matrix ... see: I ran here and it worked perfectly ..
fitData = fitData + p(n)*normpdf(binCenters,mu(n),sig(n))';
0 Kommentare
Siehe auch
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!