Issue with SEIR model for mathlab
5 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Jacobo CHoy
am 20 Mär. 2020
Kommentiert: charles aouad
am 23 Mär. 2020
Hello,
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. https://github.com/ECheynet/SEIR and also this file from the fileexchange
https://la.mathworks.com/matlabcentral/fileexchange/74545-generalized-seir-epidemic-model-fitting-and-computation
I have tried to run the example 3 ( in the github ) with all the files but when I run it I get the output :
Too many input arguments.
[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;
load('DATA.mat','tableRecovered','tableDeaths','tableConfirmed','time')
indLocation = find(contains(tableRecovered.CountryRegion,'Italy')==1)
tableRecovered(indLocation,1:2)
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;
Recovered(Confirmed<=minNum)=[];
Deaths(Confirmed<=minNum)=[];
time(Confirmed<=minNum)= [];
Confirmed(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] = ...
fit_SEIQRDP(Confirmed-Recovered-Deaths,Recovered,Deaths,Npop,E0,I0,time,guess);
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);
figure
semilogy(time1,Q,'r',time1,R,'b',time1,D,'k');
hold on
semilogy(time,Confirmed-Recovered-Deaths,'ro',time,Recovered,'bo',time,Deaths,'ko');
% 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'};
legend(leg{:},'location','southoutside')
set(gcf,'color','w')
grid on
axis tight
% ylim([1,8e4])
set(gca,'yscale','lin')
0 Kommentare
Akzeptierte Antwort
E. Cheynet
am 21 Mär. 2020
Hi,
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 Kommentare
charles aouad
am 23 Mär. 2020
Hi jacobo Thanx for your reply I am using r2018 I will try again, maybe this command only works for 2020 release?
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Web Services finden Sie in Help Center und File Exchange
Produkte
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!