Ode45 change of a value in the equations

2 ビュー (過去 30 日間)
Marco Puglia
Marco Puglia 2019 年 10 月 30 日
コメント済み: Stephan 2019 年 10 月 30 日
Hi everybody, I'm new at matlab, and I have a problem with Ode45: This is my system of equations to solve:
[tout,yout] = ode45(@(t,y) EQS(y,m,T,FN,P,D,gamma,tau), ...
[0:number_of_steps],...
initial_condition)
dPdt = + m .* T .* FN .* P - gamma .* P
dNdt = - m .* T .* FN .* P + tau .* D
dDdt = + gamma .* P - tau .* D
Ode45 works perfectly for this system but I need to change the parameter T (a vector) after a certain number of steps. How can I do that? I have tried to place loops and statemetns into the function "EQS" but Ode doesn't care about them.
  4 件のコメント
Stephan
Stephan 2019 年 10 月 30 日
365th step means t=365 for you?
Marco Puglia
Marco Puglia 2019 年 10 月 30 日
yes.

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

回答 (1 件)

Stephan
Stephan 2019 年 10 月 30 日
編集済み: Stephan 2019 年 10 月 30 日
Do 2 calls of ode45. The first from tspan=[0 365]. Then use the final result from this as initial condition for the second call with the changed T.
  2 件のコメント
Marco Puglia
Marco Puglia 2019 年 10 月 30 日
I can't. Yes, it is feasible in that way, but after this initial code, I have to build something with a T that varies periodically from a value to another.
Stephan
Stephan 2019 年 10 月 30 日
Please share your code so far

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

カテゴリ

Help Center および File ExchangeOrdinary Differential Equations についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by