非线性回归
clc;close all;clear all
ft = fittype( 'k.*(1+((k/c)^2-1).*exp(-2*a*(x-d)))^(-0.5)', 'independent', 'x', 'dependent', 'y' );
opts = fitoptions( ft );
opts.Display = 'Off';
xData1=[3.73,4.03,4.13,4.57,4.77,6.8,7.87,8.13,8.2,8.5,8.63,8.77,8.93,9.1,9.17,9.2,9.4,9.47,9.7,9.77,10.5,11.43,11.97,12.8,13,13.5];
xData=xData1';
yData1=[80,122,143,202,242,599,1323,1711,1779,2127,2240,2615,3069,3500,3967,4269,4600,5357,6263,6574,8997,14000,16203,19497,20081,22057];
yData=yData1';
% Fit
[fitresult, gof] = fit( xData, yData, ft, opts );
结果:
fitresult =
General model:
fitresult(x) = k.*(1+((k/c)^2-1).*exp(-2*a*(x-d)))^(-0.5)
Coefficients (with 95% confidence bounds):
a = 6.67
c = 8.424
d = 0.7847
k = 5831 (2721, 8941)
说明:没有指定拟合起始点,跳出一个警告但是仍有计算结果,请根据需要修改代码