how to solve this error occuring while solving ODE ''Error in ode23 (line 114) odeargumen​ts(FcnHand​lesUsed, solver_name, ode, tspan, y0, options, varargin); ''.???

1 次查看(过去 30 天)
[t,x] = ode45('phprocess',[0 5000],[0 0]);
Error using phprocess
Too many input arguments.
Error in odearguments (line 87)
f0 = feval(ode,t0,y0,args{:}); % ODE15I sets args{1} to yp0.
Error in ode45 (line 115)
odearguments(FcnHandlesUsed, solver_name, ode, tspan, y0, options, varargin);

回答(1 个)

Walter Roberson
Walter Roberson 2017-5-24
You have defined your function phprocess to not expect any arguments, or to only expect one argument. It needs to accept at least two arguments.
Also, using strings as the first argument to the ode*() functions became obsolete as of MATLAB 5.1, 20 years ago. You should use a function handle,
[t,x] = ode45(@phprocess, [0 5000], [0 0]);
  1 个评论
Steven Lord
Steven Lord 2017-5-24
Actually, function handles were introduced in MATLAB 6.0 (release R12). That was around 17 years ago, I believe, since the release after that (release R12.1) came out right around when I started at MathWorks. So not 20 years, but we have recommended function handles over char vectors as the inputs to the ODE solvers for quite a while now.

请先登录,再进行评论。

类别

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