Basic Matlab Functions Used In Complete Problems And Code 4.. Basic Matlab Functions Used In Complete Problems And Code 4... Beginning with initial values for susceptible individuals S
Trang 1HO CHI MINH UNIVERSITY OF TECHONOLOGY
Calculus 1 project report
1
The flu in world war I and New or used
Instructor: Dr Le Xuan Dai
Class: CC14-CLC_HK231
Group 4
Trang 2MEMBER LIST
Trang 3I The flu in world war I
1 Introduction
2 Theory
3 Basic Matlab Functions Used In Complete Problems And Code
4 References
II New or used
1 Introduction
2 Theory
3 Basic Matlab Functions Used In Complete Problems And Code
4 References
Trang 4I THE FLU IN WORLD WAR I
1.INTRODUCTION:
In World War I, a highly deadly strain of influenza claimed the lives of approximately 40 million individuals globally The outbreak originated in a military camp near Boston, housing 45,000 soldiers, with the first reported case
on September 7, 1918 In this task, we will create a spreadsheet for the SIR model to simulate the progression of the 1918 flu outbreak Beginning with initial values for susceptible individuals (So) and infected individuals (Io), and considering incremental time steps (denoted as Δt), we will calculate the changes
in the numbers of susceptibles and infected individuals through MATLAB software and mathematics applied
2.THEORY:
∆S ≈ -aSI∆t
∆I ≈ aSI∆t - bI∆t
1 Choosing ∆t = 0.1, a = 0.0003, b = 10, make a spreadsheet whose first few lines look like this:
2 How many soldiers got sick on the fifth day? How many were susceptible
on this day?
3 Alter the spreadsheet so that it accepts any values of ∆t, a, b input by the user
4 Using the values a = 0.000267, b = 9.865 for the 1918 epidemic, decrease the value of ∆t until a stable estimate is reached for the number of soldiers sick on September 16th How manysoldiers had been infected by this date?
5 Approximately how long did it take for the 1918 epidemic to run its
course?
3 BASIC MATLAB FUNTION USED IN COMPLETE PROBLEM AND
Trang 5For this problem, first, to easily in solving this project, through some details base
on the topic, we built a MATLAB code to creat a table that include:
- t : time
- ∆ t : change of time
- S: susceptibles
- ∆ S : change of susceptibles
- I : infecteds
- ∆ I : change of infecteds
Mathlab’s code:
45% Prompt the user for input
S0 = input('Enter initial susceptible population (S0): ');
I0 = input('Enter initial infected population (I0): ');
dt = input('Enter time increment (∆t): ');
a = input('Enter parameter a: ');
b = input('Enter parameter b: ');
% Set initial values
t = 0;
S = S0;
I = I0;
% Create arrays to store results
timeArray = [];
SArray = [];
IArray = [];
dSArray = [];
dIArray = [];
% Run the SIR model for a certain number of time steps
numSteps = 600; % You can adjust this based on your needs
for step = 1:numSteps
% Calculate changes in S and I
dS = -a * S * I * dt;
dI = a * S * I * dt - b * I * dt;
% Update S
S = S + dS;
% Store values in arrays
timeArray = [timeArray, t];
SArray = [SArray, S];
IArray = [IArray, I];
dSArray = [dSArray, dS];
dIArray = [dIArray, dI];
% Increment time and update I
t = t + dt;
Trang 6% Display the results
resultTable = table(timeArray', SArray', IArray', dSArray', dIArray', 'VariableNames' , { 't' , 'S' , 'I' , '∆S' , '∆I' });
disp(resultTable);
% Plot the results
figure;
plot(timeArray, SArray, 'b-' , timeArray, IArray, 'r-');
xlabel( 'Time' );
ylabel('Population');
legend('Susceptible (S)' , 'Infected (I)' );
title('SIR Model Simulation');
grid on ;
1 Choosing ∆t = 0.1, a = 0.0003, b = 10, make a spreadsheet whose first few lines look like the above spreadsheet:
Our spreadsheet:
Trang 72 On the fifth day, base on the spreadsheet, there were about 3.5579 soliders got sick and about 22896 susceptibles
3 the MATLAB code and spreadsheet that we had already show above Here is the graph of infecteds and susceptibles respect with time (t) (values a and
b were taken from 1.)
Trang 84 Using the values a = 0.000267, b = 9.865 for the 1918 epidemic, the beginning
of the flue was 7 September and the day we would use to calculate is 16 th th
September So that, the interval of time that we used was from 0 to 9 days Decrease the value of ∆t until a stable estimate is reached for the number of soldiers sick on September 16th
For ∆t = 0.1, we have spreadsheet nearly day 9:
……
For ∆t = 0.05, we have spreadsheet nearly day 9:
……
For ∆t = 0.005, we have spreadsheet nearly day 9:
Trang 9……
Totally, in 16 September, approximate 29 893 sodiers had been infected by the th
flu
5 approximately how long did it take for the 1918 epidemic to run its course?
- To estimate, we realize that the epidemic would end when I (the infected) were equal to 0 Then, we reused the details in section 1 to recreat a table, that is the result we had:
……
As we saw, at the time 7.7, the infected is 0.00013977 and the susceptibles of 7.6, 7.7 and 7.8 didn’t change So, we concluded that after approximately 7.7 days, the 1918 epidemic to ran its course
Trang 10II NEW OR USED:
We are having the issue towards deciding between purchasing a new or used car (of the same make) and determining the optimal number of years to keep the car Your objective is to minimize overall costs, which comprise two main
components: depreciation in the car's value and repair expenses The new car you are considering has an initial cost of $20,000 and depreciates by 20% each year Additionally, repairing costs amount to $400 in the first year, escalating by 25%
in each subsequent year By MATLAB software and mathematics applied, that problem could be solved mathematically by MATLAB software
2.THEORY
InitialValue: the initial value of the car ( = $20,000 )
Value: Value of the car
LossValue: the value which loss per year
Time: the time using (year)
LossRate: the rate of losing in value of the car ther year (=20%)
RepairCost: cost to repair the car
InitialRepairCost: initial cost to repair the car ( = $400)
RepairIncreaseCost: the increase of repair cos per year ( = 25%)
LossValue Value LossRate= ∗ time
Value InitialValue= ∗( 1−LossRate)time
RepairCost=InitialRepairCost ∗(1+RepairIncreaseCost) time
Total=Loss RepairCost+