Error in fitting two parameters with lsqnonlin

조회 수: 5 (최근 30일)
Cynthia Struijk
Cynthia Struijk 2019년 9월 18일
편집: Cynthia Struijk 2019년 9월 20일
I want to fit two parameters using lsqnonlin. I have set up my system of ODE and want to solve them with my new parameters that are found after I performed the lsqnonlin.
I think the problem has to do with the fact that my parameters are in parameter struct par and that I don't want to fit on all of these parameters, but just on basis of two of those.
This is my main script for performing the curve fitting % initial guesses for model parameters, no. of indeces is number of fitted % parameters k0 = [0.028 0.002];
Note that I want to fit for par.kb and par.kf
The error I get is:
I know my initial guesses are close enough. Does anyone know what my problem is?

채택된 답변

Matt J
Matt J 2019년 9월 18일
[curve_fit_parameters,RESNORM,RESIDUAL,EXITFLAG,OUTPUT,LAMBDA,JACOBIAN] =
...
lsqnonlin(@(k) fitcrit(k,time_exp, conc_exp, par, init),k0,LB,UB,options)
  댓글 수: 3
Cynthia Struijk
Cynthia Struijk 2019년 9월 18일
Thank you very much, I do not get any errors anymore. However, the outcoming fitted parameters seem to be my initial guessed values, but I will try to fix this myself first!
Bjorn Gustavsson
Bjorn Gustavsson 2019년 9월 18일
In addition it seems the ODE-function in the ode45-call needs to be modified to something like:
[time_model_fit,conc_model_fit] = ode45(@(t,c) CSTRSinSeries(t,c,par),time_exp,init,
[]);
The call-sequence used was the old-style method of sending in additional parameters, but since it is not to be found in the documentation (as far as I could see) it is a functionality that Mathworks might remove arbitrarily soon.

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Mathematics에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by