フィルターのクリア

In need of help with ODE45 & Index exceeds matrix dimensions, error problem

2 ビュー (過去 30 日間)
LALE ASIK
LALE ASIK 2017 年 9 月 8 日
編集済み: LALE ASIK 2018 年 4 月 7 日
I am trying to plot a graph for LKE model.
It gives the following errors:
Index exceeds matrix dimensions.
Error in SeasonalityLKE/LKEModel (line 39)
yp(1) = b*y(1)*(1-y(1)/(min(y(3),(P-theta*y(2))/q)))-(c*y(1))/(a+y(1))*y(2);
Error in odearguments (line 90)
f0 = feval(ode,t0,y0,args{:}); % ODE15I sets args{1} to yp0.
Error in ode45 (line 115)
odearguments(FcnHandlesUsed, solver_name, ode, tspan, y0, options, varargin);
Error in SeasonalityLKE (line 22)
[t,y]=ode45(@LKEModel,[0 80],[.5; .25]);

採用された回答

Walter Roberson
Walter Roberson 2017 年 9 月 9 日
Your call
[t,y]=ode45(@LKEModel,[0 80],[.5; .25]);
indicates that the initial conditions for y are [.5; .25] which is a vector of length 2.
Your LKEModel code has
yp(1) = b*y(1)*(1-y(1)/(min(y(3),(P-theta*y(2))/q)))-(c*y(1))/(a+y(1))*y(2);
which uses y(3) which implies that your need at least three initial conditions.
  1 件のコメント
LALE ASIK
LALE ASIK 2017 年 9 月 10 日
It is working now. Thank you so much for your help.

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeProgramming についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by