Error while using ode15i:Not enough input arguments.

4 views (last 30 days)
I am facing problem running the follwoing code..It gives results when it was 8x1 differential equation problem..Now adding two more differential equations provides the following error
Error using TRYING_NEWF_rungekutta>tryingode (line 202)
Not enough input arguments.
Error in TRYING_NEWF_rungekutta>@(t,y,yp)tryingode(t,y,yp) (line 22)
[yo_new,ypo_new] = decic(@(t,y,yp)tryingode(t,y,yp),to,yo,[fixed_yo],ypo,[]);
Error in decic (line 66)
res = feval(odefun,t0,y0,yp0,varargin{:});

Accepted Answer

Walter Roberson
Walter Roberson on 28 May 2022
In any current version of MATLAB, MATLAB is permitted to assume that scripts will not assign to any variable name that is also the name of a function. You assign to Idisc in the script PROP but MATLAB is permitted to assume that Idisc is still the function named Idisc and that you are invoking that function without any parameters.
The work-arounds are:
  • rename your variables to names that cannot possibly clash with any current function name or any function name that might possibly be in the MATLAB path of any user within the expected lifetime of your code; OR
  • assign something (anything) to those variables in your function before calling the script, so that MATLAB knows that they are variables; OR
  • make PROP into a function that returns a composite variable (such as a struct) that you reference in your code, such as
P = PROP();
P.Idisc...
  2 Comments
Walter Roberson
Walter Roberson on 28 May 2022
lt is a definite name clash as it is the formal name of the < function.

Sign in to comment.

More Answers (0)

Community Treasure Hunt

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

Start Hunting!

Translated by