本人做数据非线性最小二乘拟合,但是在做的过程中需要将拟合后的参数导出,或者叫传递,如下:
yield = xlsread('20141118.xls','20100412','K4:K21');t = xlsread('20141118.xls','20100412','E4:E21');
wdur=xlsread('20141118.xls','20100412','P4:P20');
plot(t,yield,'o')
hold on
dimlen=length(t);%矩阵的长度
fo = fitoptions('Method','NonLinearLeastSquares',...
'Lower',[0,-Inf,-Inf],...
'Upper',[Inf,Inf,Inf], 'StartPoint',[0 -1 -1]);%[0.045477 -0.02454 0.000149]
ftp = fittype ('b0+b1*[(1-exp(-t/tau))/(t/tau)]+b2*[(1-exp(-t/tau))/(t/tau)-exp(-t/tau)]',...
'dependent','yield','independent','t','coefficients',{'b0','b1','b2'},'problem','tau','options',fo);
[c2,gof2]= fit(t,yield,ftp,'problem',maxx)
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%分割线
结果:
c2 =
General model:
c2(t) = b0+b1*[(1-exp(-t/tau))/(t/tau)]+b2*[(1-exp(-t/tau))/(t/tau)-exp(-t/tau)]
Coefficients (with 95% confidence bounds):
b0 = 0.04371 (0.03894, 0.04848)
b1 = -0.03201 (-0.03732, -0.0267)
b2 = -0.02855 (-0.04535, -0.01175)
Problem parameters:
tau = 1.1
gof2 =
sse: 1.1407e-04
rsquare: 0.9209
dfe: 15
adjrsquare: 0.9103
rmse: 0.0028
想问:[c2,gof2]= fit(t,yield,ftp,'problem',maxx)中c2的参数(这里是b0,b1,b2)怎么才能访问、引用,例如让m=c2.coefficients.b0,因为需要参数的计算,希望大神能帮助解答一下,谢谢!!!