Not Enough input arguments

1 次查看(过去 30 天)
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)

采纳的回答

Andrei Bobrov
Andrei Bobrov 2014-3-18
编辑:Andrei Bobrov 2014-3-18
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);

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Ordinary Differential Equations 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by