How can I force Gaussian profile to fit peaks completely?
17 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Naif Alsalem
am 18 Jun. 2022
Beantwortet: Image Analyst
am 18 Jun. 2022
Hi there,
I have 3 peaks that I fitted with gaussian profile. They are connected and it looks like the gaussian fit is not reaching the dips between the peaks.
I used this line of command to fit my peaks:
f = fit(x, y, 'gauss3');
Here is the plot:
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1036535/image.jpeg)
It would be nice to get the fit down to the dips between peaks.
Thanks
0 Kommentare
Akzeptierte Antwort
Image Analyst
am 18 Jun. 2022
I'm not sure you want to fit 3 Gaussians to this waveform which is not 3 Gaussians. WHY do you think you want to do that? Let's say you did it. What would you do with that information after that? Is it really the dividing line locations, widths, and plateau center locations you want?
For what it's worth, I'm attaching a multiGaussian fitting demo where you can fir some specified number of Gaussians to your data.
0 Kommentare
Weitere Antworten (1)
Sam Chak
am 18 Jun. 2022
You can try specifying the bounds in fit options to help the algorithm to fit better...
options = fitoptions('gauss3')
options.Lower = [a1 b1 c1 a2 b2 c2 a3 b3 c3]; % specify the values for a1, b1, c1, a2, b2, c2, a3, b3, c3
options.Upper = [a1 b1 c1 a2 b2 c2 a3 b3 c3];
In your case, the amplitudes
should be non-negative, and the centers
lie around -0.1, -0.05, 0.01.
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1036565/image.png)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1036570/image.png)
Manipulate the upper bounds of the non-negative widths
with some small values until you get the desired fit to the dips.
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1036575/image.png)
However, the wavelength signal has 3 plateaus, while the gaussian function has only peaks.
0 Kommentare
Siehe auch
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!