如何在Matlab中得到高斯拟合曲线的标准差

时间:2013-07-03 01:34:39

标签: matlab curve-fitting

如何在Matlab中得到高斯拟合曲线的标准差?

它不是fit函数的输出。

代码:

[fy, god] = fit(xx, yy, 'gauss2');

输出:

>> fy

fy = 

     General model Gauss2:
     fy(x) =  a1*exp(-((x-b1)/c1)^2) + a2*exp(-((x-b2)/c2)^2)
     Coefficients (with 95% confidence bounds):
       a1 =    -0.09287  (-0.09414, -0.0916)
       b1 =        3805  (3805, 3806)
       c1 =        20.9  (19.8, 22.01)
       a2 =     -0.3454  (-0.3497, -0.3411)
       b2 =        3862  (3861, 3862)
       c2 =       19.32  (18.82, 19.82)
>> god

god = 

           sse: 2.7037e-04
       rsquare: 0.9995
           dfe: 55
    adjrsquare: 0.9994
          rmse: 0.0022

1 个答案:

答案 0 :(得分:3)

fy的输出表示您拟合的模型由两个高斯函数的线性组合组成。该模型的功能形式是:

fy(x) =  a1*exp(-((x-b1)/c1)^2) + a2*exp(-((x-b2)/c2)^2)

记住高斯定义为:

f(x) = exp(-(x-x0)^2/(2*s^2))      where: x0 is the mean, s is the std.dev.

然后模型中每个高斯的标准偏差可以计算为(分别):

s1 = c1/sqrt(2)
s2 = c2/sqrt(2)

有关详细信息,请参阅http://en.wikipedia.org/wiki/Gaussian_function