Population follows the following exponential growth rule, P = P_0 e^r In which P
ID: 2247859 • Letter: P
Question
Population follows the following exponential growth rule, P = P_0 e^r In which P is estimated population at the end of the period of consideration, P_0 is initial population at the start of period, and r is growth rate. Population of Boise is 250,000 today, with a growth rate 40% per year (r = 0.4). What will be the population of Boise in 10 years? Find the maximum, minimum and also mean of the following matrix both column-wise and row-wise. A = [5 7 3 12 1 1 7 3 4 14 8 9 9 10 2 0 11 2 11 2 10 4 7 5] Divide the interval [1 34] into 56 equally spaced values. Once use "linspace" built-in function of matlab and once do it without this command (using colon).Explanation / Answer
MATLAB CODE
clc;
clear all;
close all;
#------------ Question - 9 -----------------------#
P0=250000;
r=0.4
P=P0 * e^r;
disp("the population of Boise after 10 years:");
disp(P);
#---------------- Question - 10 ----------------- #
A=[5,7,3,12;1,1,7,3;4,14,8,9;9,10,2,0;11,2,11,2;10,4,7,5];
fprintf("finding maximum values along row wise ");
for i=1:1:6
max_value= A(i,1);
sum = 0;
for j=1:1:4
sum = sum + A(i,j);
if(A(i,j) > max_value)
max_value=A(i,j);
end
if(j == 4)
fprintf("%d row maximum value = %d ",i,max_value);
fprintf("%d row mean value = %d ",i,sum/j);
break;
end
end
end
fprintf("finding maximum values along column wise ");
for j=1:1:4
max_value= A(1,j);
sum = 0;
for i=1:1:6
sum += A(i,j);
if(A(i,j) > max_value)
max_value=A(i,j);
end
if(i == 6)
fprintf("%d column maximum value = %d ",j,max_value);
fprintf("%d column mean value = %d ",j,sum/i);
break;
end
end
end
y=linspace(1,34,56+1);
disp(y);
y1= 1:(34-1)/56:34;
disp(y1);
RESULTS:
r = 0.40000
the population of Boise after 10 years:
3.7296e+05
finding maximum values along row wise
1 row maximum value = 12
1 row mean value = 6.75
2 row maximum value = 7
2 row mean value = 3
3 row maximum value = 14
3 row mean value = 8.75
4 row maximum value = 10
4 row mean value = 5.25
5 row maximum value = 11
5 row mean value = 6.5
6 row maximum value = 10
6 row mean value = 6.5
finding maximum values along column wise
1 column maximum value = 11
1 column mean value = 6.66667
2 column maximum value = 14
2 column mean value = 6.33333
3 column maximum value = 11
3 column mean value = 6.33333
4 column maximum value = 12
4 column mean value = 5.16667
Columns 1 through 8:
1.0000 1.5893 2.1786 2.7679 3.3571 3.9464 4.5357 5.1250
Columns 9 through 16:
5.7143 6.3036 6.8929 7.4821 8.0714 8.6607 9.2500 9.8393
Columns 17 through 24:
10.4286 11.0179 11.6071 12.1964 12.7857 13.3750 13.9643 14.5536
Columns 25 through 32:
15.1429 15.7321 16.3214 16.9107 17.5000 18.0893 18.6786 19.2679
Columns 33 through 40:
19.8571 20.4464 21.0357 21.6250 22.2143 22.8036 23.3929 23.9821
Columns 41 through 48:
24.5714 25.1607 25.7500 26.3393 26.9286 27.5179 28.1071 28.6964
Columns 49 through 56:
29.2857 29.8750 30.4643 31.0536 31.6429 32.2321 32.8214 33.4107
Column 57:
34.0000
Columns 1 through 7:
1.0000 1.5893 2.1786 2.7679 3.3571 3.9464 4.5357
Columns 8 through 14:
5.1250 5.7143 6.3036 6.8929 7.4821 8.0714 8.6607
Columns 15 through 21:
9.2500 9.8393 10.4286 11.0179 11.6071 12.1964 12.7857
Columns 22 through 28:
13.3750 13.9643 14.5536 15.1429 15.7321 16.3214 16.9107
Columns 29 through 35:
17.5000 18.0893 18.6786 19.2679 19.8571 20.4464 21.0357
Columns 36 through 42:
21.6250 22.2143 22.8036 23.3929 23.9821 24.5714 25.1607
Columns 43 through 49:
25.7500 26.3393 26.9286 27.5179 28.1071 28.6964 29.2857
Columns 50 through 56:
29.8750 30.4643 31.0536 31.6429 32.2321 32.8214 33.4107
Column 57:
34.0000