Not enough input arguments.
Mostrar comentarios más antiguos
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 comentarios
Torsten
el 14 de Jun. de 2022
run_LP has several inputs. Where do you supply them ?
Just writing "run_LP" in the command window will make MATLAB error.
Sam Chak
el 14 de Jun. de 2022
Guess you want to find the Lyapunov exponents of the Lorenz system?
nune pratyusha
el 15 de Jun. de 2022
Respuestas (1)
Jan
el 14 de Jun. de 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 comentarios
nune pratyusha
el 15 de Jun. de 2022
Stephen23
el 15 de Jun. de 2022
@nune pratyusha: this line:
rhs_ext_fcn=@(x,t) l_ext(x,t,R);
requires R to be already defined. However in your code you define R nine lines later, which will not work.
Solution: define R before that line:
R = .. % <---- define R
rhs_ext_fcn=@(x,t) l_ext(x,t,R); % <---- before you refer to R here
nune pratyusha
el 15 de Jun. de 2022
@nune pratyusha: originally you defined
R=R_min;
why are you now defining it as
R=1:0.1:20;
?
In any case, the cause of the error is clear: inside L_EXT() you are trying to access elements 4-10 of array x which only has 3 elements. Trying to access non-existent array elements throws an error. This is to be expected.
You defined XSTART to have three elements, therefore the x array inside the objective function will also have three elements.
I strongly recommend that you have only one assignment per line, and align your code consistently.
nune pratyusha
el 15 de Jun. de 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.
Categorías
Más información sobre Ordinary Differential Equations en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!