[Scilab-users] Weird error with leastsq()
Dang Ngoc Chan, Christophe
Christophe.Dang at sidel.com
Thu Aug 27 16:52:21 CEST 2020
Hello all,
Let's talk about optics.
I have a glass, its refraction index n varies with the wavelength lamba.
I have a CSV file with the corresponding data (verre_HOQ.cvs attached), 52 points.
I want to model this with the Sellmeier model
https://en.wikipedia.org/wiki/Sellmeier_equation
and use for this the attached script (regression_sellmeier.sce).
Mind to set the path at line 7 of the script if you want to run it.
My problem:
I can run piecewise regression,
i.e. it runs when I work with the points 1 to 25, 13 to 39, or 32 to 52;
e.g. at lines 11 and 12, it works when I use
// ----------
lambda = 1e-3*donnees(1:25, 1); // en µm
nexp = donnees(1:25, 2);
// ----------
but when I try to extend these ranges (and of course when I try to use all the points),
it fails with the following error:
5215700pt: Wrong type for output argument #1: Real scalar expected.
Can anyone tell me what goes on here?
Regards
--
Christophe Dang Ngoc Chan
Mechanical calculation engineer
General
This e-mail may contain confidential and/or privileged information. If you are not the intended recipient (or have received this e-mail in error), please notify the sender immediately and destroy this e-mail. Any unauthorized copying, disclosure or distribution of the material in this e-mail is strictly forbidden.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: regression_sellmeier.sce
Type: application/octet-stream
Size: 1235 bytes
Desc: regression_sellmeier.sce
URL: <https://lists.scilab.org/pipermail/users/attachments/20200827/6773da90/attachment.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: verre_HOQ.csv
Type: application/octet-stream
Size: 678 bytes
Desc: verre_HOQ.csv
URL: <https://lists.scilab.org/pipermail/users/attachments/20200827/6773da90/attachment-0001.obj>
More information about the users
mailing list