Fit two peak model
Mostra commenti meno recenti
I wonder if it is possible to fit a familiar model to this data?

My first thought tends to use the mixed Gaussian model to fit a bimodal distribution. I don't know if it can work, please give some advice. Also, is there any other distribution that I can use to fit this data more properly?
1 Commento
Walter Roberson
il 28 Giu 2020
Possibly gauss2 from curve fitting toolbox? https://www.mathworks.com/help/curvefit/list-of-library-models-for-curve-and-surface-fitting.html
Risposta accettata
Più risposte (1)
Image Analyst
il 28 Giu 2020
1 voto
I've attached code, fit_two_Gaussians.m, to find two Gaussians with a slope in the x direction (to give a slightly better fit). Replace the demo (x,y) with your (x,y) and it will fit your data.

I'm also attaching a demo that fits any number of Gaussians to the data. The demo uses 6 Gaussians but you can tell it how many you want it to find.
4 Commenti
cliffy
il 30 Giu 2020
Image Analyst
il 30 Giu 2020
No, that's not correct. It's a 1-D situation.
I have an independent variable X, and for that I have one dependent variable Y, not two. So it's a 1-D situation.
It's not a 2-D situation, which would be like you're trying to fit 2-D Gaussians to "spots" or "humps" in a 2-D grayscale image. Realize that x,y is a 1-D situation while x,y and intensity (z) is a 2-D situation. 2-D data would be like I had an intensity for an x, y pair on an image.
cliffy
il 30 Giu 2020
Image Analyst
il 30 Giu 2020
What you call x is the dependent variable. So in your case the independent variable would simply be the index. So to make your data be x,y, you'd do
y = x; % Make a copy of the x variable in a variable called y.
x = 1 : length(y); % The x, or independent variable, is simply the index number.
Categorie
Scopri di più su Fit Postprocessing in Centro assistenza e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!