Академический Документы
Профессиональный Документы
Культура Документы
Table of Contents
Clean Up .......................................................................................................................... 1
Honor Statement ................................................................................................................ 1
Problem 1-2 ...................................................................................................................... 1
Function file ...................................................................................................................... 7
Clean Up
clear all
close all
clc
Honor Statement
On my honor, I have neither given nor received aid on this assignment, and I pledge that I am in compliance
with the VCU Honor System
Problem 1-2
The differential equations are:
1
Juei-Sheng Chiu - Module 3, Com-
putational Methods (EGRB 215)
data = zeros(9,5);
for i = 1:3
for k = 1:3
n = 3*(i-1)+k;
[t, y] = ode45(@sir, [0 300], [99; 01; 0], [], beta(i), nu(k));
figure(n);
plot(t, y(:,1), t, y(:,2), t, y(:,3))
xlim([0 30]);
ylim([0 100]);
legend('Susceptible','Infected','Recovered')
title(['Beta =' num2str(beta(i)) '; v=' num2str(nu(k))])
xlabel('Time (days)')
ylabel('Population (%)')
fprintf('%8s %7s %11s %12s %10s\n', 'beta', 'nu', 'max %', ...
'max time', 'R=50 time')
disp(data);
2
Juei-Sheng Chiu - Module 3, Com-
putational Methods (EGRB 215)
3
Juei-Sheng Chiu - Module 3, Com-
putational Methods (EGRB 215)
4
Juei-Sheng Chiu - Module 3, Com-
putational Methods (EGRB 215)
5
Juei-Sheng Chiu - Module 3, Com-
putational Methods (EGRB 215)
6
Juei-Sheng Chiu - Module 3, Com-
putational Methods (EGRB 215)
Function file
type sir
ydot(1) = -b*y(1)*y(2);
ydot(2) = b*y(1)*y(2) - y(2)*nu;
ydot(3) = y(2)*nu;
end