Parameters obtained using lsqcurvefit results in complex numbers.

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

Most probably, your model function produces complex values (sqrt or log or exponentiation of negative numbers).
Torsten,
Thanks for your reply. You are absolutely right my model function may produce parameter which have negative exponentiation. Still is there any way to get real parameters? Or should I ignore imaginary part of complex number?
You'll get real parameters if your model function does not produce complex results.
So what exactly is your model function ?
Torsten,
Herewith I have attached my function file "kinetic_model_12" and calling command script file "calling_commands". Please find the attachments. Data in the script file has been changed for the sake of breavity.
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).
Torsten,
You were a great help. I solved my problem with the help of your valuable inputs. NonNegative option did not work for my problem, but other suggestion (abs(PP(1))^a) worked for me. Now I am getting parameters which are real. Thank you so much for your valuable response.
But note that by this trick, the results of your ODEs might have changed compared to the original ODE without the abs().

댓글을 달려면 로그인하십시오.

답변 (0개)

카테고리

도움말 센터File Exchange에서 Nonlinear Least Squares (Curve Fitting)에 대해 자세히 알아보기

제품

릴리스

R2018b

질문:

2019년 6월 28일

댓글:

2019년 7월 3일

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by