MATLAB: I am trying to write this function for ode. But it always gives me an error as not enough input arguments. Here is the code associated:

ode45

I am trying to write this function for ode. But it always gives me an error as not enough input arguments. Here is my code associated:
function dxdt = odefcn(x,a)
dxdt = zeros(3,1);
dxdt(1) = x(2);
dxdt(2) = x(3);
dxdt(3) =-a*x(3)+x(2)-x(1);
end

Best Answer

Do not use
ode45( odefcn, .....)
Use
ode45( @odefcn, .....)
Related Question