Not enough input arguments.

조회 수: 1 (최근 30일)
nune pratyusha
nune pratyusha 2022년 6월 14일
편집: Stephen23 2022년 6월 15일
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
Sam Chak
Sam Chak 2022년 6월 14일
Guess you want to find the Lyapunov exponents of the Lorenz system?
nune pratyusha
nune pratyusha 2022년 6월 15일
yes, I want lyapunov exponent v/s parameters plot so, i am trying it

댓글을 달려면 로그인하십시오.

답변 (1개)

Jan
Jan 2022년 6월 14일
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
nune pratyusha
nune pratyusha 2022년 6월 15일
i changed the code but i didn't get any output
function run_Lp(n,rhs_ext_fcn,tstart,stept,tend,xstart,nk);
figure()
hold on;
n=3;
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=1:R_step:10; R =R+R_step;
rhs_ext_fcn=@(t,x) l_ext(t,x,R);
while R<=R_max
lk= lya(n,rhs_ext_fcn,tstart,stept,tend,xstart);
R =R+R_step;
plot(R,lk);
end
Stephen23
Stephen23 2022년 6월 15일
편집: Stephen23 2022년 6월 15일
@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.

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Programming에 대해 자세히 알아보기

제품


릴리스

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by