[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [leasqr] simple fit does not converge
From: |
Martijn |
Subject: |
Re: [leasqr] simple fit does not converge |
Date: |
Wed, 26 Jan 2011 11:50:51 +0100 |
Hi,
The remarks on the list made look into the data. The problem was with
the data: Ntab contained a number of NaN's.
Since this is a general help list and no bug list, I feel free to post
problems with octave forge functions as well.
Martijn
On Tue, 2011-01-25 at 23:52 +0100, Martijn wrote:
> 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
>
> _______________________________________________
> Help-octave mailing list
> address@hidden
> https://mailman.cae.wisc.edu/listinfo/help-octave