How to fix Error in ode45 in matlab
Afficher commentaires plus anciens
Hi friends I have both script and function file that come up with the error below. The files are expected to solve Epidemic model and plot out put. I need assistance please
the files:
function dydt = naijacfun(t,y)
% state variables
S = y(1);
E = y(2);
I = y(3);
J = y(4);
K =y(5);
R = y(6);
D = y(7);
% model parameters
alphae = 0.59;eta2 = 0.3;gammac = 0.4;deltac = 0.1;alphaa = 0.2456;
alphas = 0.361;eta1 = 0.2;sigma = 0.192;gammaa = 0.142;gammas = 0.143;deltas = 0.043;
dydt = zeros(2,1);
%The model equations
dydt(1) = - S*(alphae*E+alphaa*I+alphas*J+ alphac*K);
dydt(2) = S*(alphae*E+alphaa*I+alphas*J+ alphac*K )-sigma*E;
dydt(3) = (1-eta1-eta2)*sigma*E-(gammaa*I);
dydt(4) = eta1*sigma*I-(gammas+deltas)*J;
dydt(5) = eta2*sigma*I-(gammac+deltac)*K;
dydt(6) = gammaa*I1+gammas*I2+gammac*I3;
dydt(7) = deltas*I2+deltac*I3;
end
I got the following error massage
Error in ode45 (line 115)
odearguments(FcnHandlesUsed, solver_name, ode, tspan, y0, options, varargin);
Error in naijacscript (line 4)
[t,y] = ode45(@naijacfun,tspan, y0)
1 commentaire
Walter Roberson
le 16 Août 2020
Unrecognized function or variable 'alphac'.
You initialize alphaa, alphae, alphas, but not alphac
Réponses (0)
Catégories
En savoir plus sur Ordinary Differential Equations dans Centre d'aide et File Exchange
Produits
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!