How can I use for loop to input values when solving ODEs using ode45?

1 回表示 (過去 30 日間)
Dursman Mchabe
Dursman Mchabe 2019 年 2 月 13 日
コメント済み: Dursman Mchabe 2020 年 12 月 26 日
Hi everyone
On the attached code, I am trying to use a for loop to iteratively input values while solving ODEs using ode45. I think I am making a mistake somewhere. I get the error message:
Not enough input arguments.
Error in SlurryCaseODE45Feb14/kinetics (line 31)
[T,Cv]=ode45(@DifEq,t,c0,Options);
Error in lsqcurvefit (line 213)
initVals.F = feval(funfcn_x_xdata{3},xCurrent,XDATA,varargin{:});
Error in SlurryCaseODE45Feb14 (line 166)
[theta,Rsdnrm,Rsd,ExFlg,OptmInfo,Lmda,Jmat]=lsqcurvefit(@kinetics,theta0,t,c);
Caused by:
Failure in initial objective function evaluation. LSQCURVEFIT cannot continue.
Please help.

採用された回答

aara
aara 2019 年 2 月 13 日
You have to define the initial and final time for the ode45 function rather than just typing t, use [t0 tf].
I suggest editting the function function dC=DifEq(t,c) as it has some missing matrix multiplication operators (.*) and revising the matrix formations that you used. Check line 39 for example.
  7 件のコメント
ABHISEK PATI
ABHISEK PATI 2020 年 12 月 24 日
please share your solution i am also stuck at same
Dursman Mchabe
Dursman Mchabe 2020 年 12 月 26 日
Sorry, I misplaced the file.

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeProgramming についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by