THIS THING SUDDENLY WORKS --> [fopt,p,gopt] = leastsq(iprint=2, #(p)->(LIN(p,i')-y') , p0); p
***** enters -qn code- (without bound cstr) dimension= 2, epsq= 0.2220446049250313E-15, verbosity level: iprint= 2 max number of iterations allowed: iter= 100 max number of calls to costf allowed: nap= 100 ------------------------------------------------ iter num 1, nb calls= 1, f= 348.9 iter num 2, nb calls= 3, f= 8.451 iter num 3, nb calls= 5, f= 3.886 iter num 4, nb calls= 6, f= 2.913 iter num 5, nb calls= 8, f= 2.913 iter num 6, nb calls= 23, f= 2.913 iter num 6, nb calls= 31, f= 2.913 ***** leaves -qn code-, gradient norm= 0.4763135673514921E-09 optim: End of optimization. p = [2x1 double] 0.2515611 2.3108774 > On 04.07.2025, at 03:32, Heinz Nabielek <heinznabie...@me.com> wrote: > > Nonlinear least-squares fitting leastsq has worked well for me, but now it > does not work. WHY? > Heinz > > [i' y'] > 1. 2.2926212 > 2. 5.6416618 > 3. 6.8354947 > 4. 8.5651459 > 5. 11.640645 > 6. 14.978644 > 7. 16.87252 > 8. 18.989384 > 9. 20.894666 > 10. 22.903085 > p0=[2;3], // should be circa[0;2] > > function yhat=LIN(p, x) > yhat=p(1)+p(2)*x > endfunction > > [fopt,p,gopt]=leastsq(#(p)->(LIN(p,i'),y'),p0); p > p = [2x1 double] > > 2. > 3. > // JUST WRONG _______________________________________________ users mailing list - users@lists.scilab.org Click here to unsubscribe: <mailto:users-unsubscr...@lists.scilab.org> https://lists.scilab.org/mailman/listinfo/users This email and any attachments are intended solely for the use of the individual or entity to whom it is addressed and may be confidential and/or privileged. If you are not one of the named recipients or have received this email in error, (i) you should not read, disclose, or copy it, (ii) please notify sender of your receipt by reply email and delete this email and all attachments, (iii) Dassault Systèmes does not accept or assume any liability or responsibility for any use of or reliance on this email. Please be informed that your personal data are processed according to our data privacy policy as described on our website. Should you have any questions related to personal data protection, please contact 3DS Data Protection Officer https://www.3ds.com/privacy-policy/contact/