HELP NEEDED_ODE45MATLAB
2 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Hi, I am new to MATLAB and hoping any one can help me.
I am trying to simulate non linear ODE but could not able to get the output.
Can anyone please help me to highlight the problem and its solution?
Below is my code:
% initial parameters
Y=[1.4e+7 0 0];
T=Y(:,1);
M=Y(:,2);
A=Y(:,3);
%define constant
a=2.31e-1; % growth rate of tumor
b=2.146e-10; % inverse of carrying capacity
c=5.156e-14; % rate of NK-induced tumor death
E=6.5e+10; %rate of NK-induced tumor death through ADCC
h1=1.25e+6; % concentration of half-maximal increase in ADCC
N=9e+7;
D= 0.9774;
Kt=0.81; % rate of chemotherapy induced tumor death
Kat=4e-4; %Additional chemotherapy induced tumor death due to mAB
e=0.111;
al=2e-1; % Medicine efficient coefficient
v=0.0228; % rate of mAB induced tumor death
g=4.077e-1; %rate of excretion and elimination of chemotherapy drug
n=1.386e-1; %rate of mab turn over and excretion
lam=8.9e-14; %rate of mab tumor cell complex formation
h2=4.45e-5; %concentration of mAbs for half maximal EGFR binding
%time span
tspan= (0:0.01:25);
[t,Y]=ode45(@ODEfun,tspan,Y0);
semilogy(t, Y(:,1), '-b',t,Y(:,2),'--m',t, Y(:,3), '--k');
ylim([0 10^10]);
xlim([0 25]);
title('Irinotecan/Cetuximab Therapy:Moderate D Response');
legend({'Tumor cells';'Chemo Conc', 'MAB Conc.'});
xlabel('Time(Days)');
ylabel('Log(Cells, Concentration)');
function dY=ODEfun(t,Y,a,b,c,E,h1,N,D,Kt,Kat,e,al,v,g,n,lam,h2)
dY=zeros(3,1);
dY(1)= a*Y(1)*(1-b*Y(1)) - (c+ E*Y(3)/(h1+Y(3)))*(N*Y(1)) - (D*Y(1)) - (Kt + Kat*Y(3))*(1 - e^(-al*Y(2)))*Y(1) - v*Y(3)*Y(1);
if t < 2/24
dY(2)= (((-g*Y(2))+57.947));
else
dY(2)= (-g*Y(2));
if t > 0 && t < 2/24
dY(3)= (-n*Y(3))-((lam+Y(1)*(Y(3)/h2+Y(3))+139.072));
elseif t == 7 || t == 14 || t == 21 || t == 28
dY(3)= (-n*Y(3))-((lam+Y(1)*(Y(3)/h2+Y(3))+173.840));
else
dY(3)= (-n*Y(3))-((lam+Y(1)*(Y(3)/h2+Y(3))));
end
end
end
Herebelow is the error:
Not enough input arguments.
Error in final1>ODEfun (line 42)
dY(1)= a*Y(1)*(1-b*Y(1)) - (c+ E*Y(3)/(h1+Y(3)))*(N*Y(1)) - (D*Y(1)) - (Kt + Kat*Y(3))*(1 - e^(-al*Y(2)))*Y(1) -
v*Y(3)*Y(1);
Error in odearguments (line 90)
f0 = feval(ode,t0,y0,args{:}); % ODE15I sets args{1} to yp0.
Error in ode45 (line 115)
odearguments(FcnHandlesUsed, solver_name, ode, tspan, y0, options, varargin);
Error in final1 (line 31)
[t,Y]=ode45(@ODEfun,tspan,Y0);
0 Kommentare
Antworten (2)
ME
am 2 Dez. 2019
Your problem here is that you haven't passed your parameters into the function. The line:
function dY=ODEfun(t,Y,a,b,c,E,h1,N,D,Kt,Kat,e,al,v,g,n,lam,h2)
means you need to pass each of the parameters a, b, c, E, h1, N, D, Kt, Kat, e, al, v, g, n, lam and h2 here into the function in order for it to work. In your code you have only given it:
[t,Y]=ode45(@ODEfun,tspan,Y0);
so you'll need to change this for something like:
[t,Y]=ode45(@ODEfun,tspan,Y0,a,b,c,E,h1,N,D,Kt,Kat,e,al,v,g,n,lam,h2);
Note that the order in the list of parameters needs to match or they will be wrongly used inside the ODE function.
0 Kommentare
Walter Roberson
am 2 Dez. 2019
Also, all of the ode*() functions require that the functions be continuous in their second derivative. In most cases if there is an if statement inside the ode function then you are violating the continuity requirements. You should be breaking your ode45 call up into several calls to ode45(), one with tspan [0 2/24], one with tspan [2/24 7], one with [7 14], one with [14 21], one with [21 25]. Based on the code you would expect [21 28] but your original tspan ends at 25.
At each ode45 call, you would take the last output of the previous call and use it as the boundary conditions for the new call. Well, really you should also calculate for times 7, 14, 21 exactly individually, so like [2/24 7], [7 7], [7*(1+eps) 14], [14 14], [14*(1+eps) 21], [21 21], [21*(1+eps) 25] . The ode*() functions are not designed to expect instantaneous impluses.
Like, what physical process could even inject those doses instanteously?? Your monoconal antibodies have mass, and moving mass in zero time requires infinite energy !
0 Kommentare
Siehe auch
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!