Not enough input arguments.
    3 views (last 30 days)
  
       Show older comments
    
i am getting error like:
>> run_Lp
xstart =
     0     0     1
Not enough input arguments.
Error in l_ext (line 11)
f(2)=-x(1).*x(3)+R*x(1)-x(2);
Error in odearguments (line 90)
f0 = feval(ode,t0,y0,args{:});   % ODE15I sets args{1} to yp0.
Error in ode45 (line 106)
  odearguments(FcnHandlesUsed, solver_name, ode, tspan, y0, options, varargin);
Error in lya (line 19)
  [T,Y] = ode45(rhs_ext_fcn,[t t+stept],x,R);
Error in run_Lp (line 9)
        lk= lya(n,rhs_ext_fcn,tstart,stept,tend,xstart,R); 
>> 
3 Comments
Answers (1)
  Jan
      
      
 on 14 Jun 2022
        Do not provide parameters as appended variables in the ODE45 call:
% In lya:
[T,Y] = ode45(rhs_ext_fcn,[t t+stept],x,R);
%                                       ^  nope
Use an anonymous function to provide parameters:
% in run_Lp:
% Nope: rhs_ext_fcn = @l_ext;
R_max=10; 
R_min=1; nk=10; tstart=0; stept=0.5; tend=20; xstart=[0 0 1]
R_step=(R_max-R_min)/nk;
R=R_min;
rhs_ext_fcn = @(x, t) l_ext(x, t, R);
6 Comments
  Stephen23
      
      
 on 15 Jun 2022
				
      Edited: Stephen23
      
      
 on 15 Jun 2022
  
			@nune pratyusha: the WHILE loop never runs.
Consider your variables:
R_max =
    10
R =
    1.9000    2.8000    3.7000    4.6000    5.5000    6.4000    7.3000    8.2000    9.1000   10.0000   10.9000
which you use on this line:
while R<=R_max
The WHILE documentation states "An expression is true when its result is nonempty and contains only nonzero elements (logical or real numeric). Otherwise, the expression is false."
Question: are all of the expression elements you provide to WHILE true?
Answer: no (because 10.9 is greater than 10, so that last element will be false).
So your WHILE loop never runs.
I doubt that R should be a vector.
I strongly recommend that you have one assignment per line, and consistently align your code.
See Also
Categories
				Find more on Ordinary Differential Equations in Help Center and File Exchange
			
	Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!



