Finding sigma from fit using Curve Toolbox gaussian?

30 vues (au cours des 30 derniers jours)
Gary
Gary le 22 Jan 2013
I am using the gaussin fitting functions in the Matlab curve fitting toolbox, which uses the model:
ans(x) = a1*exp(-((x-b1)/c1)^2) + a2*exp(-((x-b2)/c2)^2)
This all works well for my data and I get the fits, but now I want to know what sigma is for these two gaussians? That isn't just c, is it? Can someone tells me how the fit coefficients relate to sigma?
Much appreciation.
Gary

Réponses (1)

Shashank Prasanna
Shashank Prasanna le 22 Jan 2013
Modifié(e) : Shashank Prasanna le 22 Jan 2013
If you look at the gaussian equation the curve fitting toolbox fits:
you will notice that it is different from the standard normal/gaussian distribution equation given here:
which means you can equate the coefficients you can equate them and get the value of sigma.
a1 = 1/sigma*sqrt(2*pi)
-1/c^2 = -1/2*sigma^2
  1 commentaire
Fynn Reinbacher
Fynn Reinbacher le 5 Nov 2020
sigma = 1/(a*sqrt(2*pi));
Has to be used with caution.
This works only for normalized datasets.
In the matlab version of the gaussian:
where f(x) is the data you fitted.
For nomalized data and the above answer is indeed valid
In order to get σ from a you'd need to integrate your data first
% if:
[x, cnts] = load('mydata.mat'); % data you are fitting
f1 = fit(x, cnts, 'gauss1');
% then:
mu = f1.b1;
sigma = f1.c1/sqrt(2);
% or:
intergral = trapz(x, cnts);
sigma = integral/(f.a1*sqrt(2*pi));
This has me bugged for a long time.

Connectez-vous pour commenter.

Catégories

En savoir plus sur Get Started with Curve Fitting Toolbox dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by