Issue with SEIR model for mathlab

조회 수: 13(최근 30일)
Jacobo CHoy
Jacobo CHoy 2020년 3월 20일
댓글: charles aouad 2020년 3월 23일
I am quite new in mathlab and i am trying to test the SEIR model but i can not get it to run. I have problems when i try to run the code.
I am using this github repository to calculate it. and also this file from the fileexchange
I have tried to run the example 3 ( in the github ) with all the files but when I run it I get the output :
Error using SEIQRDP
Too many input arguments.
Error in example3 (line 38)
[S,E,I,Q,R,D,P] = SEIQRDP(alpha1,beta1,gamma1,delta1,Lambda1,Kappa1,Npop,E0,I0,Q0,R0,D0,t);
I put the example 3 file below,
maybe you can help me find the issue? It might be very simple...
The example 3 file.
clearvars;close all;clc;
indLocation = find(contains(tableRecovered.CountryRegion,'Italy')==1)
indLocation = indLocation(1)
Recovered = table2array(tableRecovered(indLocation,5:end));
Deaths = table2array(tableDeaths(indLocation,5:end));
Confirmed = table2array(tableConfirmed(indLocation,5:end));
% If the number of confirmed Confirmed cases is small, it is difficult to know whether
% the quarantine has been rigorously applied or not. In addition, this
% suggests that the number of infectious is much larger than the number of
% confirmed cases
minNum= 40;
time(Confirmed<=minNum)= [];
Npop= 120e6; % population
guess = [0.06,1.2,1/5,1/40,0.01,0.02,0.01,0.02]; % my guess for the fit
E0 = Confirmed(1); % Initial number of exposed cases (we do not know it, so it is set at zero)
I0 = Confirmed(1); % Initial number of infectious cases (we do not know it, so it is the number of quarantined)
Q0 = Confirmed(1);
R0 = Recovered(1);
D0 = Deaths(1);
[alpha1,beta1,gamma1,delta1,Lambda1,Kappa1] = ...
dt = 0.1; % time step
time1 = datetime(time(1)):dt:datetime(2020,3,25,0,0,0);
N = numel(time1);
t = [0:N-1].*dt;
[S,E,I,Q,R,D,P] = SEIQRDP(alpha1,beta1,gamma1,delta1,Lambda1,Kappa1,Npop,E0,I0,Q0,R0,D0,t);
hold on
% ylim([0,1.1*Npop])
ylabel('Number of cases')
xlabel('time (days)')
% leg = {'susceptible','exposed','infectious','quarantined','recovered','Dead','insusceptible'};
leg = {'Quarantined (confirmed infectious)','recovered','Dead'};
grid on
axis tight
% ylim([1,8e4])

채택된 답변

E. Cheynet
E. Cheynet 2020년 3월 21일
I am not able to reproduce your error. The file is running normally on my Matlab version, both with a live script and a normal script. I see one possibility for the error you have: you use an older version of SEIQRDP. Previous versions of SEIQRDP accepted less inputs than the new one.
  댓글 수: 5
charles aouad
charles aouad 2020년 3월 23일
Hi jacobo Thanx for your reply I am using r2018 I will try again, maybe this command only works for 2020 release?

댓글을 달려면 로그인하십시오.

추가 답변(0개)

Community Treasure Hunt

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

Start Hunting!

Translated by