Only getting zero as my output for ode45

조회 수: 29 (최근 30일)
Harry Parker
Harry Parker 2020년 11월 23일
댓글: Harry Parker 2020년 11월 26일
Hi,
So I'm producing a model based on a paper I've recently reviewed. When entering it into ode45 it only ouputs 0 as the value of X. I believe this is because X0 = 0. Though this is the correct initial condition is there anyway to work around this.
function dxdt = microalgal_model(t, X)
uxmax = 0.275; %h-1
%fxS variables
kxs = 0.0624; %gSL-1
kixs = 12.40; %gSL-1
%fxN variables
kxn = 0.0812; %gNL-1
kixn = 0.6250; %gNL-1
%fxI variables
kxi = 45.50; %uEm-2s-2
kixi = 297.75; %uEm-2s-2
o = 0.7419; %gX-1Lm-1
l = 0.25; %m
%fxT variables
aox = 0.6175; %h-1
eax = 25.9243; %Kcalmol-1
r = 0.0099858775; %Kcalmol-1
to = 293; %K
box = 0.1101; %h-1
ebx = 48.0151; %Kcalmol-1
S = 1.05;
N = 0.098;
Io =125;
T = 303;
fxS = S / (S + kxs + ((S^2)/kixs));
fxN = N / (N + kxn + ((N^2)/kixn));
Il = Io*exp(-o*X*l);
fxI = Il / (Il + kxi + ((Il^2)/kixi));
fxT = aox * exp((-eax/r)*((1/T)-(1/to))) - box * exp ( (-ebx/r)*((1/T)-(1/to)));
ux = uxmax * fxS * fxN * fxI * fxT;
dxdt = ux * X;
end
tspan = [0 192];
X0 = 0;
[t, X] = ode45(@(t,X) microalgal_model(t,X), tspan, X0);
plot(t,X)

답변 (2개)

Jon
Jon 2020년 11월 23일
The "problem" is that x0 = 0 is an equilibrium point of your system dx/dt = 0 when x = 0.
So if you start the system at x0 = 0 then it doesn't go anywhere, it just stays at zero.
Please try for a non-zero initial condition and you will see that it infact evolves to another value.
If you don't think x0 should be an equilibrium point then you need to look further into your equations in microalgal_model as currently they evaluate to zero when x = 0
  댓글 수: 1
Harry Parker
Harry Parker 2020년 11월 26일
Thanks, I had a look through the literature and found a non zero X0 value

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


Star Strider
Star Strider 2020년 11월 23일
Give it something other than 0 as the intial condition, for example:
X0 = 0+eps;
That worked when I tried it.

태그

Community Treasure Hunt

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

Start Hunting!

Translated by