二阶高斯函数
输入:
x=[129.2926,122.5626,117.0427,109.4045,101.8072,97.1049,88.5742,78.3659,67.9594,59.6875,52.5793,47.9517,41.0180,33.7457,26.0918];
y=[18.33,21.96,26.54,33.79,33.84,38.28,43.245,101.72,155.88,174.5,165.87,159.03,123.98,72.22,41.8];
输出:
二阶高斯函数模型中六个参数 a1,b1,c1,a2,b2,c2
Matlab代码:
x=[129.2926,122.5626,117.0427,109.4045,101.8072,97.1049,88.5742,78.3659,67.9594,59.6875,52.5793,47.9517,41.0180,33.7457,26.0918];
y=[18.33,21.96,26.54,33.79,33.84,38.28,43.245,101.72,155.88,174.5,165.87,159.03,123.98,72.22,41.8];
fre = fit( x', y', 'Gauss2');
beta=[fre.a1,fre.b1,fre.c1,fre.a2,fre.b2,fre.c2]';
xx = linspace(min(x),max(x),100);
yy = fre.a1*exp(-((xx-fre.b1)/fre.c1).^2) + ...
fre.a2*exp(-((xx-fre.b2)/fre.c2).^2);
plot(x,y,'r.',xx,yy);
legend('原始数据','拟合数据');
title('二阶高斯函数拟合');
运行结果:
-0.5980
68.6444
1.1613
172.8436
58.7376
29.0755
问题描述:
C语言用牛顿迭代法求解参数时,出现奇异矩阵。如下图增广矩阵的最简形式中,得出c2为0,但实际函数模型中,c2为分母,不能为零,产生矛盾,无法进行下一步迭代。