[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
## [leasqr] simple fit does not converge

**From**: |
Martijn |

**Subject**: |
[leasqr] simple fit does not converge |

**Date**: |
Tue, 25 Jan 2011 23:52:49 +0100 |

Hi,
I am fitting a dispersion function (the Sellmeier equation) to
tablulated refractive index data but leasqr.m does not converge. I am
able to fit e.g. a sine to a data set, so leasqr does work.
After reduction to the bare essentials my code looks like:
E=0.5:.05:6;
E=E(:);
Ntab = sqrt(GetSopraDielFunc(E, 'bk7'));
f = @(E, p) sqrt(1+p(1)./(1-p(2)*E.^2/1.54));
p0 = [1.25, .011];
[Nslm, p, convg, niter] = leasqr(E, Ntab, p0, f);
plot(E, [Ntab, Nslm], 'linewidth', 2)
The strange thing is that not only the covergence is not achieved, but p
does not differ from p0, indicating something is going really wrong.
The initial estimate is pretty good as can be seen by
plot(E, Ntab, E, f(E, [1.25, 0.011])
What's wrong here? Is it possible to show the intermediate values of p?
Where is leasqrdemo gone? If I remember correctly, it did show the
intermediate parameter values.
Thanks,
Martijn

**[leasqr] simple fit does not converge**,
*Martijn* **<=**