y=[0 0.06 0.11 0.17 0.23 0.28 0.34 0.40 0.46 0.52 0.59 0.65 0.72 0.80 0.87 0.96 1.05 1.16 1.31 1.55]';
x=[20.02 18.95 17.79 17.00 16.12 14.97 13.96 13.01 12.10 11.07 10.11 8.95 7.99 6.93 5.99 5.03 4.04 3.02 2.01 1.01]';
st_ = [0.5 0.5 10];
ft_ = fittype('((19.98-x)*(1+35/c)+a*log(19.98/x))/b' ,...
'dependent',{'y'},'independent',{'x'},...
'coefficients',{'a', 'b','c'});
fitoptions('METHOD','NonlinearLeastSquares');
[cf,good]= fit(x,y,ft_,'Startpoint',st_)
h_ = plot(cf,'fit',0.95);
legend off; % turn off legend from plot method call
set(h_(1),'Color',[1 0 0],...
'LineStyle','-', 'LineWidth',2,...
'Marker','none', 'MarkerSize',6);
hold on,plot(x,y,'*')
cf =
General model:
cf(x) = ((19.98-x)*(1+35/c)+a*log(19.98/x))/b
Coefficients (with 95% confidence bounds):
a = 12 (-6.033e+006, 6.033e+006)
b = 47.18 (-2.371e+007, 2.371e+007)
c = 37.8 (-3.951e+007, 3.951e+007)
good =
sse: 0.0015
rsquare: 0.9996
dfe: 17
adjrsquare: 0.9995
rmse: 0.0094