Error using feval and in odearguments?

6 vues (au cours des 30 derniers jours)
Muse Riveria
Muse Riveria le 29 Déc 2015
Commenté : Muse Riveria le 30 Déc 2015
I'm trying to simulate the SEIR model for dengue fever using the following differential equations:
function ypseir =ypseir(t,y)
u=0.0045
N=5535002
S=5535002
E=50
I=50
J=0
R=0
v=0.0045
B=0.375
o=1/8.5
z=1/6
ypseir(1) = u*N-((B*(J/N))+u)*S
ypseir(2) = ((B *(J/N))*S)-(u+o)*E
ypseir(3) = o*E+(u+z)*I
ypseir(4) = z*I-u*R
ypseir = [ypseir(1) ypseir(2) ypseir(3) ypseir(4)]';
to = 0;
tf =100;
yo = [5535002 50 50 0];
[t y] = ode45('ypseir',[to tf],yo);
plot(t,y(:,1),t,y(:,2),t,y(:,3),y(:,4))
title('Human Population Without Control')
xlabel('time')
ylabel('susceptible, exposed, infected, recovered')
And I'm presented with the following errors:
Error using feval Maximum recursion limit of 500 reached.
Error in odearguments (line 87) f0 = feval(ode,t0,y0,args{:}); % ODE15I sets args{1} to yp0.
Truthfully I'm unsure how to use MATLAB and compute the SEIR model. Help is needed! Thank you!

Réponses (1)

Walter Roberson
Walter Roberson le 29 Déc 2015
Store the below in ypseir_driver.m
function ypseir_driver
to = 0;
tf =100;
yo = [5535002 50 50 0];
[t y] = ode45(@ypseir,[to tf],yo);
plot(t, y(:,1), 'c', t, y(:,2), 'y', t, y(:,3), 'r', t, y(:,4), 'b')
title('Human Population Without Control')
xlabel('time')
ylabel('susceptible, exposed, infected, recovered')
legend('susceptible', 'exposed', 'infected', 'recovered');
function dy = ypseir(t,y)
u = 0.0045;
N = 5535002;
S = 5535002;
E = 50;
I = 50;
J = 0;
R = 0;
v = 0.0045;
B = 0.375;
o = 1/8.5;
z = 1/6;
dy(1,1) = u*N-((B*(J/N))+u)*S;
dy(2,1) = ((B *(J/N))*S)-(u+o)*E;
dy(3,1) = o*E+(u+z)*I;
dy(4,1) = z*I-u*R;
  1 commentaire
Muse Riveria
Muse Riveria le 30 Déc 2015
Hi! Thank you for your answer, despite following your instructions (whilst the error did disappear), when I "ran" the functions no graph was computed.

Connectez-vous pour commenter.

Catégories

En savoir plus sur Deep Learning Toolbox dans Help Center et File Exchange

Tags

Produits

Community Treasure Hunt

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

Start Hunting!

Translated by