Finding sigma from fit using Curve Toolbox gaussian?

30 visualizaciones (últimos 30 días)
Gary
Gary el 22 de En. de 2013
Comentada: Fynn Reinbacher el 5 de Nov. de 2020
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

Respuestas (1)

Shashank Prasanna
Shashank Prasanna el 22 de En. de 2013
Editada: Shashank Prasanna el 22 de En. de 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 comentario
Fynn Reinbacher
Fynn Reinbacher el 5 de Nov. de 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.

Iniciar sesión para comentar.

Categorías

Más información sobre Get Started with Curve Fitting Toolbox en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by