2013-07-03 108 views
0

如何从Matlab中的高斯拟合曲线中获得标准偏差?如何从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 

回答

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了解更多信息。