Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Matlab question Bacterial growth is often characterized with an exponential equa

ID: 2082081 • Letter: M

Question

Matlab question Bacterial growth is often characterized with an exponential equation, shown below. Here B is the current number of bacteria, B_init is the initial number of bacteria, and rate is the rate of growth. B = B_init * exp(t * GRate) Create a matrix which calculates the number of bacteria B for different values of B_init and GRate at t = 10 days. For B_init ten values ranging from 100 to 1.000 bacteria in increments of 100. For GRate. use ten values ranging from 0.02 to 0.2 per day in increments of 0.02. Your final matrix will be a 10 times 10 with the number of bacteria at 10 days under the 100 conditions. Note that the values of bacteria in your matrix must be whole numbers. This can be done using mathematical functions with the variables B_init and GRate which correspond to the row and column (respectively) of the matrix B. For example: B(1, 1) = 100 * exp(10 * 0.02) B(2, 1) = 200 * exp(10 * 0.02) The first two lines of code should look like this: for B_init= 1:10 for GRate= 1:10 If you start with 500 bacteria, what growth rate would you want so that at 10 days you had roughly 3.000 bacteria? What is the difference in number of bacteria at day 10 if you start with 100 versus 1000 bacteria if they are growing at an exponential growth rate of 0.2 per day? What is the sum of bacteria for all 10 growth rate conditions starting with 200 bacteria?

Explanation / Answer

%vector to store differnet rate of growth of bacteria
rate=[0.02 0.04 0.06 0.08 0.10 0.12 0.14 0.16 0.18 0.20];

%vector to store differnet initial bacteria value
t=10;bin=[100 200 300 400 500 600 700 800 900 1000];   

b=zeros(10,10); %initializing a matrix of 10*10 to store number
%of bactria according to growth rate and initial bacteria
  
for b_init=1:10
for grate=1:10
b( b_init,grate)=bin(b_init).*exp(t*rate(grate));
end
end
%number of bacteria
bactria=floor(b) %floor is used to get number in whole number


%given b=3000,b_init=500,t=10...find grate
ba=3000;b_in=500;
gr=(1/t).*logm(ba/b_in)
fprintf('growth rate would be 0.18 approx')


%growth rate=0.2 bin1=100;bin2=1000,t=10...
grt=0.2;
bin1=100;bin2=1000;
numb_bact_bin1=bin1*exp(t*grt);
numb_bact_bin2=bin2*exp(t*grt);
fprintf('difference in number of bacteria for binit=100 and 1000')
diff_numb=floor(numb_bact_bin2)-floor(numb_bact_bin1)


%grate as defined in beginning of program binit=200
bi=200;sum=0;
for grate=1:10
b( grate)=floor(bi.*exp(t.*rate(grate)));
sum=sum+b(grate);
end
fprintf('sum of bacteria for binit=200 and with growth rate')
sum

output:

bactria =

Columns 1 through 6

122 149 182 222 271 332
244 298 364 445 543 664
366 447 546 667 815 996
488 596 728 890 1087 1328
610 745 911 1112 1359 1660
732 895 1093 1335 1630 1992
854 1044 1275 1557 1902 2324
977 1193 1457 1780 2174 2656
1099 1342 1639 2002 2446 2988
1221 1491 1822 2225 2718 3320

Columns 7 through 10

405 495 604 738
811 990 1209 1477
1216 1485 1814 2216
1622 1981 2419 2955
2027 2476 3024 3694
2433 2971 3629 4433
2838 3467 4234 5172
3244 3962 4839 5911
3649 4457 5444 6650
4055 4953 6049 7389


gr =

0.1792

growth rate would be 0.18 approx

difference in number of bacteria for binit=100 and 1000
diff_numb =

6651

sum of bacteria for binit=200 and with growth rate
sum =

7045