what's wrong my code about ode model

I had to training course 'solve ordinary differential equation in MATLAB online course'
and I wrote that one but this code doesn't run
how can I modify that??
The first error has line 3 ' C=Y(1)'
function dY=ESdynamics(t,Y,r_C,Cprime,r_max,k,r_A,delta_A,r_I,delta_I,r_E,Eprime,r_S,Sprime,beta,gamma)
C=Y(1);
A=Y(2);
I=Y(3);
E=Y(4);
S=Y(5);
f(C)=min(r_C*(1-C/Cprime),r_max);
dC=f(C)*C-k*C*E;
dA=r_A*C-delta_A*A;
dI=r_I*C*E-delta_I*I;
dE=-r_E*(E-Eprime)+beta*A*I*E*S-gamma*E*S;
dS=-r_S*(S-Sprime)-beta*A*I*E*S+gamma*E*S;
end

3 件のコメント

Dyuman Joshi
Dyuman Joshi 2023 年 6 月 9 日
Please copy and paste the full error code, that means all of the red text. Also attach the values used to call the function.
You have not defined the output "dY" in your code.
기훈 강
기훈 강 2023 年 6 月 9 日
thanks
Walter Roberson
Walter Roberson 2023 年 6 月 9 日
Note that ode45 and related functions will produce incorrect answers when min() or max() are used.

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

回答 (0 件)

カテゴリ

質問済み:

2023 年 6 月 9 日

コメント済み:

2023 年 6 月 9 日

Community Treasure Hunt

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

Start Hunting!

Translated by