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 Center および File ExchangeProgramming についてさらに検索

製品


リリース

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by