MATLAB: Bad fit with lsqnonlin LM

bad fitlsqnonlinMATLAB

I am trying to create a solver that will fit the following. Y data has been normalised to 1.
param0 = 0;
opts = optimset('lsqnonlin'); % method
opts.Algorithm = 'levenberg-marquardt';
opts.Display = 'iter';
TR=0.0055
Xk = [0.0785398163397448 0.165806278939461 0.235619449019234 0.270526034059121 0.523598775598299];
Yk = [0.451237263464338 0.810771470160116 0.965065502183406 1 0.991266375545852]
modelfun = @(a) ((1-exp(-TR/a))*sin(Xk)) ./ (1-cos(Xk)*exp(-TR/a)) - Yk;
[estcoefs,resnorm,residual,exitflag,output] = lsqnonlin(modelfun,param0,[],[],opts);
I am getting unrealistic values from using lsqnonlin. For this data, I know the result should be 0.08. This can be verified if I put 0.08 into the model and compare with the data.
plot(Xk,Yk,'b')
plot(Xk,((modelfun(estcoefs))+Yk)/max(modelfun(estcoefs)+Yk),'r');
plot(Xk,(modelfun(0.08)+Yk)/max(modelfun(0.08)+Yk),'g')
Can anyone help me with this issue?

Best Answer

Your criterion for a good fit is quite strange. Regardless, lsqnonlin uses a least squares fitting criterion and, with respect to that criterion, lsqnonlin has succeeded in giving you a superior solution:
>> norm(modelfun(estcoefs))
ans =
1.3673
>> norm(modelfun(.08))
ans =
1.6047