ODE45: Check for missing argument or incorrect argument | Error in odearguments (line 90) & ode45 (line 115)
Show older comments
Hello,
I searched this forum and others for an solution but didnt find any that helped me.
I get the Following Errorcodes:
Check for missing argument or incorrect argument data type in call to function 'SIR_DGLSystem'.
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 SIRDModell/Solve_DGL (line 61)
[obj.t, obj.SIR] = ode45(@SIR_DGLSystem, [obj.t0, obj.tF], [obj.N, obj.S, obj.I, obj.R], [], [obj.beta, obj.gamma, obj.mu, obj.v]);
My Code is a class, wich I broke into pieces to analyse it better. You first type x = SIRDModell() then Solve_DGL(x). hen the Errorcode comes up.
I'm really clueless on this one!
classdef SIRDModell
properties
S
I
R
D
t0
tF
t % Zeitvektor
gamma
mu
k % Kappa Kontaktrate
Lamda % Übertragungswahrscheinlichkeit
beta
v
T % Transmissionskoeffizient b/N
N
end
methods
function obj = SIRDModell()
%Werte über die Bevölkerung
obj.N = 1000; %Population
obj.I = 3; %Infizierte
obj.R = 0; %Genese
obj.D = 0; %Gestorbene
obj.S = obj.N - obj.I - obj.R - obj.D; %nicht Infizerte
%Werte über die Krankeheit
obj.beta = 0.4; %Infektionsrate
obj.gamma = 0.4;%Sterbe oder genese Rate
obj.mu = 0.04; %allgemeine Sterberate
obj.v = 0.05; %Geburtenrate
obj.T = obj.beta./obj.N; %Transmissionsrate
obj.Lamda = (obj.beta .* obj.I) ./ obj.N ; %Infektionsrate
%Zeitraum
obj.t0 = 0; %Startzeit
obj.tF = 100; %Endzeit
%obj.dt = 1; %Zeititterationne
end
function obj = Solve_DGL(obj)
% ODEFUn TSPAN y0 Options par
[obj.t, obj.SIR] = ode45(@SIR_DGLSystem, [obj.t0, obj.tF], [obj.N, obj.S, obj.I, obj.R], [], [obj.beta, obj.gamma, obj.mu, obj.v]);
end
function dSIR_dt = SIR_DGLSystem(t, SIRD, par)
%SIRD(1) = N; SIRD(2) = S; SIRD(3) = I; SIRD(4) = R
%par(1) = beta, par(2) = gamma, par(3) = mu, par(4) = v
dSIR_dt(1,1) = par(4)*SIRD(1) -(par(1)*SIRD(2)*SIRD(3)) ./SIRD(1) - par(3)*SIRD(2);
dSIR_dt(2,1) = (par(1)*SIRD(2)*SIRD(3))./SIRD(1) - par(2)*SIRD(3) - par(3)*SIRD(3);
dSIR_dt(3,1) = par(2)*SIRD(3) - par(3)*SIRD(4);
dSIR_dt(4,1) = par(3).*SIRD(3);
end
end
end
2 Comments
Torsten
on 29 May 2021
I don't know if this is the reason for the error message: You supply four initial conditions to ode45, but only solve for three unknowns.
Lennart Gravert
on 29 May 2021
Accepted Answer
More Answers (0)
Categories
Find more on Ordinary Differential Equations in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!