implementation of an ODE system, not the expected output

1 Ansicht (letzte 30 Tage)
Sylvain Bart
Sylvain Bart am 19 Sep. 2019
Kommentiert: Sylvain Bart am 20 Sep. 2019
Hello,
I don’t get what I would like with my ODE systems and I don’t understand why, if someone could help me it would be great (thank you to any readers)
I have 6 variables input: S DwA DwB Dw TH and K and several constant parameters
Here is my function:
y=[1 0 0 0 0 0]
function dy = deri(t,y,par,cA,cB)
%% Unpack states
S = y(1);
DwA = y(2);
DwB = y(3);
Dw = y(4);
TH =y(5);
K =y(6);
%% Unpack parameters values
kdA = par(1);
mwA = par(2);
bwA = par(3);
hbA = par(4);
kdB = par(5);
mwB = par(6);
bwB = par(7);
hbB = par(8);
hb = max(hbA,hbB);
%% Calculate the model output
dDwA = kdA * (cA - DwA);
dDwB = kdB * (cB - DwB);
dDw=dDwA +dDwB; % Dw(t)= DwA(t) + DwB(t)
% until here I get everything I expect (the expected values) for the three above variables
% here are the issues
dTH=(mwA*(dDwA/dDw)) + (mwB*(dDwB/dDw)); % for TH I don’t get the expected values, and I don’t know why
% at each time point it should be: TH(t)=(mwA*(DwA(t)/Dw(t))) + (mwB*(DwB(t)/Dw(t))), TH should decrease over time
dK=(bwA*(dDwA/dDw)) + (bwB*(dDwB/dDw))
% I have the same issue for K (same equation but with the constants bwA and bwB)
% For the following I don't know as TH and K are not calculate as expected
h = K * max(0,Dw-TH); % calculate h
dS = -(h + hb)* S; %change in survival probability
dy = [dS;dDwA;dDwB;dDw;dTH;dK]; % collect derivatives in one vector
Many thanks in advance for any answers
Sylvain
  2 Kommentare
Sylvain Bart
Sylvain Bart am 20 Sep. 2019
Thank you for your reply, it was useful to know this and I will use it in the futur.

Melden Sie sich an, um zu kommentieren.

Antworten (0)

Kategorien

Mehr zu Programming finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by