Is there a specific matlab function that would allow my program to estimate a guassian distrubution for each of the peaks found (in this case 5 peaks).

 채택된 답변

Image Analyst
Image Analyst 2022년 4월 15일

0 개 추천

Yes. I'm attaching a demo that can fit any number of Gaussians. It's setup for 6 in the demo but you can adapt it to 5 by changing the proper variable. Attach your data if you can't figure it out.

댓글 수: 4

1804Hz
1804Hz 2022년 4월 15일
Thanks a lot for your help, is it fine if I can ask you a follow up question?
Image Analyst
Image Analyst 2022년 4월 15일
You just did. You can ask another one if you want.
1804Hz
1804Hz 2022년 4월 16일
If I wanted to find the start and end points of the peaks is there a built-in function i can use or do I need to make a for loop to identify it?
As long as there are definite valleys between the peaks (and it's not just like a skewed hump) then you can use findpeaks(). Just negate the signal to find valleys instead of peaks
[valleyValues, indexesOfValleys] = findpeaks(-signal);
valleyValues = -valleyValues;
findpeaks() has lots of parameters to control how big or small the peaks is so you might have to tweak some of those.

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

추가 답변 (1개)

the cyclist
the cyclist 2022년 4월 15일
편집: the cyclist 2022년 4월 15일

1 개 추천

If you have the underlying data the fitgmdist function in the Statistics and Machine Learning Toolbox does this sort of fit. Here is some code I wrote, that fits an example (with just two peaks):
MU1 = 1;
SIGMA1 = 1;
MU2 = -3;
SIGMA2 = 1;
X = [mvnrnd(MU1,SIGMA1,1000);mvnrnd(MU2,SIGMA2,1000)];
figure
histogram(X,51)
options = statset('Display','final');
obj = fitgmdist(X,2,'Options',options)
26 iterations, log-likelihood = -4090.22 obj = Gaussian mixture distribution with 2 components in 1 dimensions Component 1: Mixing proportion: 0.499743 Mean: 1.0487 Component 2: Mixing proportion: 0.500257 Mean: -3.0288
The output obj has more stats in it.

카테고리

질문:

2022년 4월 15일

댓글:

2022년 4월 16일

Community Treasure Hunt

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

Start Hunting!

Translated by