In need of help with ODE45 & Index exceeds matrix dimensions, error problem
1 vue (au cours des 30 derniers jours)
Afficher commentaires plus anciens
LALE ASIK
le 8 Sep 2017
Modifié(e) : LALE ASIK
le 7 Avr 2018
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]);
0 commentaires
Réponse acceptée
Walter Roberson
le 9 Sep 2017
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.
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Ordinary Differential Equations dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!