Parameters obtained using lsqcurvefit results in complex numbers.
Ältere Kommentare anzeigen
Hi. I tried to fit simultaneous ODE using lsqcurvefit. Code works well and provide parameters. But parameters are coming as complex number. In my case parameters must be real number. How to restrict parameters to real numbers using lsqcurvefit?
7 Kommentare
Torsten
am 28 Jun. 2019
Most probably, your model function produces complex values (sqrt or log or exponentiation of negative numbers).
Ghansyam Vadodaria
am 28 Jun. 2019
Torsten
am 28 Jun. 2019
You'll get real parameters if your model function does not produce complex results.
So what exactly is your model function ?
Ghansyam Vadodaria
am 29 Jun. 2019
Torsten
am 1 Jul. 2019
Either try to use the NonNegative option of the ODE solvers or - if this does not work - abs(PP(1))^a (same for the other exponentiations).
Ghansyam Vadodaria
am 3 Jul. 2019
Torsten
am 3 Jul. 2019
But note that by this trick, the results of your ODEs might have changed compared to the original ODE without the abs().
Antworten (0)
Kategorien
Mehr zu Nonlinear Least Squares (Curve Fitting) finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!