You are on page 1of 17

1

By: M. Ali Amin

COVID 19 SPREAD

I have collected, the following data from the website


https://www.coronatracker.com/country/pakistan/
For the number of coronavirus patients for the past 14 days that is from 22 nd of
May 2020 to June 4 2020.

DAYS NO. OF PATIENTS


1 50694
2 52437
3 54601
4 56349
5 57705
6 59151
7 61227
8 64028
9 66457
10 69496
11 72460
12 72460
13 80463
14 85264

Now, I have written a program in MATLAB 2020A, which uses the exponential
growth model for predicting the number of covid19 patients in the coming days.
2

I have used the above data, for finding the model. If, I am wrong then please
forgive me. As to err is human. Everyone should try.
Thanks

Therefore, here is the program

clc;
clear all;
close all;

format long;

% Define the symbolic variable rate r for the spread of covid 19 virus.

syms r;

% Enter the data of covid-19 confirmed cases for the last 14-days as a
vector ..

covid1914daysdata = input('Enter the last 14 days data as a vector\n


covid1914daysdata = ');

% Enter the no. of covid 19 patients on day1 which is May 22nd 2020

noofcovid19day1 = input('Enter the number of covid19 patients on day1 \n


noofcovid19day1 = ');

% Enter the no. of covid 19 patients on day14 which is 4th june 2020

noofcovid19day14 = input('Enter the number of covid19 patients on day 14 \n


noofcovid19day14 = ');

% Enter the day until you have collected the data which is day 14

t = input('Enter the count of the last day for which you have collected the
covid 19 patients\n t = ');

% Form the Equation...

eqn = noofcovid19day14 == noofcovid19day1 * exp(r*t);

% Solve the equation for rate r


3

rate = solve(eqn,r);

Rate = double(subs(rate))

% WE SHALL GET THE FOLLOWING MODEL WE GET IS THE FOLLOWING which will give us
the no. of covid 19 patients at a particular day...

% ENTER THE TIME AS A VECTOR.

time = input('Enter the time as a vector starting from 0 as day 1 \n time =


');

noofcovid = noofcovid19day1 * exp(Rate * time); % Required Model

%DISPLAY THE outputs

for i = 1: length(covid1914daysdata)

fprintf("\n\n You entered covid 19 patients on day %d is %f\n\n", i,


covid1914daysdata(i))
end

fprintf("\n\n\n")

for i = 1: length(noofcovid)

fprintf("The Number of covid 19 patients by using the model on day %d is


%f\n\n", time(i), noofcovid(i));

end

plot(time, noofcovid)

title('\bf Number of COVID 19 patients')

xlabel('Time which is number of days')


4

Run the program as follows and get the desired result.

Enter the last 14 days data as a vector


covid1914daysdata = [50694 52437 524601 56349 57705 59151 61227 64028
66457 69496 72460 72460 80463 85264]
Enter the number of covid19 patients on day1
noofcovid19day1 = 50694
Enter the number of covid19 patients on day 14
noofcovid19day14 = 85264
Enter the count of the last day for which you have collected the covid 19
patients
t = 14

Rate =

0.037138911796833

Enter the time as a vector starting from 0 as day 1


time = 0:1:99

You entered covid 19 patients on day 1 is 50694.000000


5

You entered covid 19 patients on day 2 is 52437.000000

You entered covid 19 patients on day 3 is 524601.000000

You entered covid 19 patients on day 4 is 56349.000000

You entered covid 19 patients on day 5 is 57705.000000

You entered covid 19 patients on day 6 is 59151.000000

You entered covid 19 patients on day 7 is 61227.000000


6

You entered covid 19 patients on day 8 is 64028.000000

You entered covid 19 patients on day 9 is 66457.000000

You entered covid 19 patients on day 10 is 69496.000000

You entered covid 19 patients on day 11 is 72460.000000

You entered covid 19 patients on day 12 is 72460.000000

You entered covid 19 patients on day 13 is 80463.000000


7

You entered covid 19 patients on day 14 is 85264.000000

The Number of covid 19 patients by using the model on day 0 is 50694.000000

The Number of covid 19 patients by using the model on day 1 is 52612.117935

The Number of covid 19 patients by using the model on day 2 is 54602.812040

The Number of covid 19 patients by using the model on day 3 is 56668.828394

The Number of covid 19 patients by using the model on day 4 is 58813.016978

The Number of covid 19 patients by using the model on day 5 is 61038.335609

The Number of covid 19 patients by using the model on day 6 is 63347.854018

The Number of covid 19 patients by using the model on day 7 is 65744.758088

The Number of covid 19 patients by using the model on day 8 is 68232.354245

The Number of covid 19 patients by using the model on day 9 is 70814.074022


8

The Number of covid 19 patients by using the model on day 10 is 73493.478792

The Number of covid 19 patients by using the model on day 11 is 76274.264679

The Number of covid 19 patients by using the model on day 12 is 79160.267658

The Number of covid 19 patients by using the model on day 13 is 82155.468848

The Number of covid 19 patients by using the model on day 14 is 85264.000000

The Number of covid 19 patients by using the model on day 15 is 88490.149201

The Number of covid 19 patients by using the model on day 16 is 91838.366785

The Number of covid 19 patients by using the model on day 17 is 95313.271476

The Number of covid 19 patients by using the model on day 18 is 98919.656757

The Number of covid 19 patients by using the model on day 19 is 102662.497482

The Number of covid 19 patients by using the model on day 20 is 106546.956740

The Number of covid 19 patients by using the model on day 21 is 110578.392977


9

The Number of covid 19 patients by using the model on day 22 is 114762.367387

The Number of covid 19 patients by using the model on day 23 is 119104.651585

The Number of covid 19 patients by using the model on day 24 is 123611.235565

The Number of covid 19 patients by using the model on day 25 is 128288.335969

The Number of covid 19 patients by using the model on day 26 is 133142.404656

The Number of covid 19 patients by using the model on day 27 is 138180.137607

The Number of covid 19 patients by using the model on day 28 is 143408.484160

The Number of covid 19 patients by using the model on day 29 is 148834.656595

The Number of covid 19 patients by using the model on day 30 is 154466.140087

The Number of covid 19 patients by using the model on day 31 is 160310.703025

The Number of covid 19 patients by using the model on day 32 is 166376.407735

The Number of covid 19 patients by using the model on day 33 is 172671.621598


10

The Number of covid 19 patients by using the model on day 34 is 179205.028593

The Number of covid 19 patients by using the model on day 35 is 185985.641275

The Number of covid 19 patients by using the model on day 36 is 193022.813211

The Number of covid 19 patients by using the model on day 37 is 200326.251878

The Number of covid 19 patients by using the model on day 38 is 207906.032060

The Number of covid 19 patients by using the model on day 39 is 215772.609738

The Number of covid 19 patients by using the model on day 40 is 223936.836521

The Number of covid 19 patients by using the model on day 41 is 232409.974611

The Number of covid 19 patients by using the model on day 42 is 241203.712341

The Number of covid 19 patients by using the model on day 43 is 250330.180296

The Number of covid 19 patients by using the model on day 44 is 259801.968050

The Number of covid 19 patients by using the model on day 45 is 269632.141530


11

The Number of covid 19 patients by using the model on day 46 is 279834.261039

The Number of covid 19 patients by using the model on day 47 is 290422.399967

The Number of covid 19 patients by using the model on day 48 is 301411.164200

The Number of covid 19 patients by using the model on day 49 is 312815.712267

The Number of covid 19 patients by using the model on day 50 is 324651.776258

The Number of covid 19 patients by using the model on day 51 is 336935.683516

The Number of covid 19 patients by using the model on day 52 is 349684.379168

The Number of covid 19 patients by using the model on day 53 is 362915.449494

The Number of covid 19 patients by using the model on day 54 is 376647.146193

The Number of covid 19 patients by using the model on day 55 is 390898.411552

The Number of covid 19 patients by using the model on day 56 is 405688.904585

The Number of covid 19 patients by using the model on day 57 is 421039.028145


12

The Number of covid 19 patients by using the model on day 58 is 436969.957073

The Number of covid 19 patients by using the model on day 59 is 453503.667404

The Number of covid 19 patients by using the model on day 60 is 470662.966688

The Number of covid 19 patients by using the model on day 61 is 488471.525443

The Number of covid 19 patients by using the model on day 62 is 506953.909818

The Number of covid 19 patients by using the model on day 63 is 526135.615473

The Number of covid 19 patients by using the model on day 64 is 546043.102751

The Number of covid 19 patients by using the model on day 65 is 566703.833182

The Number of covid 19 patients by using the model on day 66 is 588146.307361

The Number of covid 19 patients by using the model on day 67 is 610400.104266

The Number of covid 19 patients by using the model on day 68 is 633495.922061

The Number of covid 19 patients by using the model on day 69 is 657465.620440


13

The Number of covid 19 patients by using the model on day 70 is 682342.264578

The Number of covid 19 patients by using the model on day 71 is 708160.170745

The Number of covid 19 patients by using the model on day 72 is 734954.953641

The Number of covid 19 patients by using the model on day 73 is 762763.575523

The Number of covid 19 patients by using the model on day 74 is 791624.397200

The Number of covid 19 patients by using the model on day 75 is 821577.230942

The Number of covid 19 patients by using the model on day 76 is 852663.395407

The Number of covid 19 patients by using the model on day 77 is 884925.772629

The Number of covid 19 patients by using the model on day 78 is 918408.867182

The Number of covid 19 patients by using the model on day 79 is 953158.867566

The Number of covid 19 patients by using the model on day 80 is 989223.709923

The Number of covid 19 patients by using the model on day 81 is


1026653.144162
14

The Number of covid 19 patients by using the model on day 82 is


1065498.802592

The Number of covid 19 patients by using the model on day 83 is


1105814.271140

The Number of covid 19 patients by using the model on day 84 is


1147655.163274

The Number of covid 19 patients by using the model on day 85 is


1191079.196718

The Number of covid 19 patients by using the model on day 86 is


1236146.273074

The Number of covid 19 patients by using the model on day 87 is


1282918.560449

The Number of covid 19 patients by using the model on day 88 is


1331460.579217

The Number of covid 19 patients by using the model on day 89 is


1381839.291022

The Number of covid 19 patients by using the model on day 90 is


1434124.191146
15

The Number of covid 19 patients by using the model on day 91 is


1488387.404376

The Number of covid 19 patients by using the model on day 92 is


1544703.784500

The Number of covid 19 patients by using the model on day 93 is


1603151.017559

The Number of covid 19 patients by using the model on day 94 is


1663809.729018

The Number of covid 19 patients by using the model on day 95 is


1726763.594979

The Number of covid 19 patients by using the model on day 96 is


1792099.457613

The Number of covid 19 patients by using the model on day 97 is


1859907.444954

The Number of covid 19 patients by using the model on day 98 is


1930281.095226

The Number of covid 19 patients by using the model on day 99 is


2003317.485876
16

The program also gives the following plot.


17

106 Number of COVID 19 patients


2

1.8

1.6

1.4

1.2

0.8

0.6

0.4
X0
0.2
Y 50690
0
0 10 20 30 40 50 60 70 80 90 100
Time which is number of days

You might also like