This code is incorrect, so I need to correct it to plot a bifurcation

Define the DDE function

function ddefunc

% Define parameters

kappa = 0.1; % kappa

eta = 0.2; % eta

theta = 0.1; % theta

epsilon = 0.01; % epsilon

sigma = 0.05; % sigma

phi = 0.02; % phi

xi = 1; % delay value

% Define the DDEs

ddefun = @(t, y, Z) [kappa - eta*Z(3,1)*y(1)*exp(-kappa*xi) - (kappa + phi)*y(1); % dS/dt

eta*Z(3,1)*y(1)*exp(-kappa*xi) - (theta + kappa)*y(2); % dE/dt

theta*y(2) - (epsilon + sigma + kappa)*y(3); % dI/dt

sigma*y(3) + phi*y(1) - kappa*y(4)]; % dR/dt

% Solve the DDE

sol = dde23(ddefun, xi, [0.99, 0.01, 0, 0], [0, 50]);

% Solve DDE for different xi values and plot bifurcation

xi_values = linspace(0, 0.5, 50); % Range of delay values

max_I = zeros(size(xi_values)); % To store max I values

for i = 1:length(xi_values)

xi = xi_values(i);

sol = dde23(ddefun, xi, [0.99, 0.01, 0, 0], [0, 50]);

max_I(i) = max(sol.y(3, :)); % Max value of I(t)

end

% Plot bifurcation diagram

figure;

plot(xi_values, max_I, 'b', 'LineWidth', 2);

xlabel('Delay \xi');

ylabel('Max Infectious Population I_{max}');

title('Bifurcation Diagram of SEIR Model with Delay');

grid on;

end

More Mohamed H Hassan's questions See All
Similar questions and discussions