Error using ode45 (line 87) Not enough input arguments. See ODE45.

1 view (last 30 days)
function molarflow
%[V,F] = solver(ode45,'q2', [0,1], [0.15;0.85;0;0;0]);
Fa = f(1);
Fo = f(2);
Fn = f(3);
Fw = f(4);
x = f(5);
k = 1;
Ft = Fa+Fo+Fn+Fw;
Fa0 = 0.15;
Fo0 = 0.85;
vf0 = 5;
ct0 = Fo0/vf0 +Fa0/vf0;
ca = ct0*Fa0/Ft;
co = ct0*Fo0/Ft;
ra = -k*ca^2*co;
dFadV = ra*4;
dF0dV = ra*5;
dFndV = -ra*4;
dFwdV = -ra*6;
dxdV = -ra/Fo0;
molarflow = [dFadV; dF0dV; dFndV; dFwdV; dxdV];
when i put [V,F] = solver(ode45,'q2', [0,1], [0.15;0.85;0;0;0]); to mathlab it comes with error Error using ode45 (line 87) Not enough input arguments. See ODE45. please help
  1 Comment
Geoff Hayes
Geoff Hayes on 7 Mar 2015
aysan - why not just remove the solver function and call ode45 directly as
[V,F] = ode45('q2',[0,1], [0.15;0.85;0;0;0]);
Preasumably q2 is a function that you have defined somewhere within the MATLAB search path.
(To be honest, I don't know what the solver call does only that it doesn't seem to pass the inputs that you have provided correctly to ode45.)

Sign in to comment.

Answers (1)

Jan
Jan on 7 Mar 2015
In this line
[V,F] = solver(ode45, 'q2', [0,1], [0.15;0.85;0;0;0])
the function ode45 is called without any inputs. It is equivalent to:
[V,F] = solver(ode45(), 'q2', [0,1], [0.15;0.85;0;0;0])
I don't know, what solver is, but perhaps you want:
[V,F] = solver(@ode45, 'q2', [0,1], [0.15;0.85;0;0;0])
In the following line you access "f(1)", but there is no variable "f".

Tags

Community Treasure Hunt

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

Start Hunting!