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.FSC_Histogram.png

답변 (2개)

Image Analyst
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.
0000 Screenshot.png

댓글 수: 2

Douglas Bock
Douglas Bock 2018년 12월 11일
Many thanks Image Analyst!
I have previously considered hardcoding the GMM function to fit the data.
However, I may have anything between 1 and 10 peaks for which I need the gaussians. This would require me to hardcode 10 different GMM, which, although doable, would make the fitgmdist function redundant. I want to exploit that one of the arguements for fitgmdist is the number of peaks to be detected...
Image Analyst
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.

댓글을 달려면 로그인하십시오.

Alfredo Dinho
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에 대해 자세히 알아보기

질문:

2018년 12월 7일

답변:

2021년 5월 26일

Community Treasure Hunt

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

Start Hunting!

Translated by