MATLAB: Errors using ode45: “Not enough input arguments”. I am not sure what this errors try to tell me, I performed this type of problems before using ode45 and never ran into such error. I have carefully checked the codes. Any suggestions/explanation

notenoughinputargumentsode45systemsofodes

%%solve_ODEs_system_CancerECM
function solve_ODEs_system_CancerECM
% ouput is concentration of collagen fibers and enzyme MMPs in the ECM
% describe degradation of ECM due to MMPs
% system of ODEs are obtained and further derived from toma a.-a novel
% method for simulating the ECM in models of tumor growth
%%Description of Input and output parameters or varibales:
%%Input
% Dm : diffusion coefficient of enzyme MMPs
% alpha_m: decay coefficient of MMPs
% beta_m: production rates of MMPs
% alpha_f: uptake parameter of ECM
% beta_f: remodeling parameter of ECM
% m1: concentration of MMPs
% m2: 1st order derivative of m1
%%Units of Input and output parameters or varibales:
%%Setup initital conditions for the ODE solver
clear;
f_0 = 1;
m1_0 = 0.1;
m2_0 = 0.1;
f0_and_m0 = [f_0; m1_0; m2_0];
%%Define the t range and increments
t0 = 0;
tf = 10;
t = t0:0.01:tf;
%%Call the ODE solver
[t,y]=ode45(@ODEs_system_CancerECM,t,f0_and_m0);
%%Retrive values for each variables from output solution
f = y(:, 1);
m1 = y(:, 2);
m2 = y(:, 3);
%%Figure 1: Plot the results of T vs. V
figure(1)
plot(t,f)
title('ECM density vs. time')
xlabel('time')
ylabel('ECM density')
%%Figure 2: Plot the results of Fi vs. V
figure(2)
plot(t,m1,'r--',t,m2,'bs')
legend('MMPs concentration','[MMP] rate of change','location','best')
title('[MMPs] vs. time')
xlabel('time')
ylabel('[MMP]')
%%Define system of ODEs
function dydt = ODEs_system_CancerECM(t,f,m1, m2)
%%All parameters (using tentative values for now) --> UPDATE
% Dm and alpha_m, and even beta_m can be obtained from literature
Dm = 0.08 ; %toma
alpha_m = 0.02 ;
beta_m = 0.01 ;
% alpha_f and beta_f can be approximated following parameter
% estimation methods (lsqcurvefit, for example)
alpha_f = 0.01 ;
beta_f = 0.015 ;
%%Define ODEs system
d_f_dt = -alpha_f*f*m1 + beta_f*f;
d_m1_dt = m2;
d_m2_dt = (1/Dm)*m2 + (alpha_m/Dm)*m1 - (1/Dm)*beta_m;
%%Return results as column vector
dydt = zeros(3,1);
dydt(1,1)= d_f_dt;
dydt(2,1)= d_m1_dt;
dydt(3,1)= d_m2_dt;
end
end

Best Answer

You call
[t,y]=ode45(@ODEs_system_CancerECM,t,f0_and_m0);
which implies that ODEs_system_CancerECM is to be called with t and y arguments over a timespan of t, with initial conditions f0_and_m0
You define
function dydt = ODEs_system_CancerECM(t,f,m1, m2)
which expects to be passed 4 arguments.
I speculate that you want
function dydt = ODEs_system_CancerECM(t,fm)
f = fm(1); m1 = fm(2); m2 = fm(3);