Using fitgmdist on a Histogram
이전 댓글 표시
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.

답변 (2개)
Image Analyst
2018년 12월 7일
1 개 추천
Fit the count data with fitnlm. I attach a demo for two Gaussians. Make the obvious adaptations for 4 Gaussians.

댓글 수: 2
Douglas Bock
2018년 12월 11일
Image Analyst
2018년 12월 11일
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
2021년 5월 26일
0 개 추천
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))';
카테고리
도움말 센터 및 File Exchange에서 Histograms에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!