ode45 keeps giving me the error shown below.

21 views (last 30 days)
I keep getting these errors shown below when I try to run my file.
Error in ode45 (line 107)
odearguments(odeIsFuncHandle,odeTreatAsMFile, solver_name, ode, tspan, y0, options, varargin);
Error in BMEN3010_Problem16_4 (line 16)
[YSol,tSol] = ode45(@odefun,tspan,Ca0); %Solution for Ca
File:
a = 0.459;
lambda1 = 1.11*10^(-2); %units min^-1
lambda2 = 1.38*10^(-4); %units min^-1
Cp0 = 100; %units nM
t = 0:7200; %units min due to lambdas
%input parameters, then solve ODE for Ca
G0 = 100; %units nM
Ka = 10^-9*10^9; %units nM^-1
phi = 0.243; %unitless, fraction of tumor volume that is interstitial fluid - where antibody exists
k = 0.5; %units µL*g^-1*min^-1
ke = 0.8; %same units as k
Cp = Cp0*(a*exp(-lambda1.*t)+(1-a)*exp(-lambda2.*t));
plot(t,Cp)
Ca0 = 0; %initial condition
tspan = [0,7200];
[YSol,tSol] = ode45(@odefun,tspan,Ca0); %Solution for Ca
hold on
plot(tSol,YSol)
function dYdt = odefun(t,Y)
G0 = 100;
phi = 0.243;
k = 0.5;
ke = 0.8;
rho = 10^-3;
Cp = Cp0*(a*exp(-lambda1.*t)+(1-a)*exp(-lambda2.*t));
dYdt = rho*(k/phi.*Cp-ke*Y)/(1+ka*G0/(1+ka*Y)+ka*G0*Y/(1+ka*Y)^2);
end
  1 Comment
VBBV
VBBV on 15 Sep 2022
Edited: VBBV on 15 Sep 2022
Declare all the variables used inside the function odefun or pass them as arguments to function

Sign in to comment.

Accepted Answer

VBBV
VBBV on 15 Sep 2022
a = 0.459;
lambda1 = 1.11*10^(-2); %units min^-1
lambda2 = 1.38*10^(-4); %units min^-1
Cp0 = 100; %units nM
t = 0:7200; %units min due to lambdas
%input parameters, then solve ODE for Ca
G0 = 100; %units nM
Ka = 10^-9*10^9; %units nM^-1
phi = 0.243; %unitless, fraction of tumor volume that is interstitial fluid - where antibody exists
k = 0.5; %units µL*g^-1*min^-1
ke = 0.8; %same units as k
Cp = Cp0*(a*exp(-lambda1.*t)+(1-a)*exp(-lambda2.*t));
subplot(211)
plot(t,Cp)
Ca0 = 0; %initial condition
tspan = [0,7200];
[YSol,tSol] = ode45(@odefun,tspan,Ca0); %Solution for Ca
subplot(212)
plot(tSol,YSol)
function dYdt = odefun(t,Y)
G0 = 100;
lambda1 = 1.11*10^(-2); %units min^-1
lambda2 = 1.38*10^(-4); %units min^-1
phi = 0.243;
a = 0.459;
k = 0.5;
ke = 0.8;
rho = 10^-3;
Cp0 = 100;
ka = 10^-9*10^9; %units nM^-1
Cp = Cp0*(a*exp(-lambda1.*t)+(1-a)*exp(-lambda2.*t));
dYdt = rho*(k/phi.*Cp-ke*Y)/(1+ka*G0/(1+ka*Y)+ka*G0*Y/(1+ka*Y)^2);
end

More Answers (0)

Products


Release

R2022a

Community Treasure Hunt

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

Start Hunting!