Not Enough input arguments

2 views (last 30 days)
Melissa
Melissa on 18 Mar 2014
Commented: Melissa on 20 Mar 2014
I get the not enough input arguments for a function I made and am trying to pass through ode23. I followed the ode23 syntax but I'm not sure why it is caught up at this point.
My function file:
1-function dydx=solver(x,y)
2-dydx=x-y
How I call my function file:
1-xspan=[0,1];
2-y0=2;
3-
4-[xo,yo]=ode23(solver,xspan,y0)
this also results in an error, supposedly line 4 but it won't say what the error is.
Here are my error messages:
Error using solver (line 2) Not enough input arguments.
Error in ME140_inclassactivity16_runge_kutta (line 4) [xo,yo]=ode23(solver,xspan,y0)

Accepted Answer

Andrei Bobrov
Andrei Bobrov on 18 Mar 2014
Edited: Andrei Bobrov on 18 Mar 2014
solver = @(t,y)t - y;
xspan = [0,1];
y0 = 2;
[xo,yo] = ode23(solver,xspan,y0);
if solver as m - file (your case):
[xo,yo] = ode23(@solver,xspan,y0);

More Answers (0)

Community Treasure Hunt

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

Start Hunting!