You are on page 1of 4

IT1005 Lab 06 Answer Book

Problem 1
i) Rearranging the equations give:

-(EB+QA) 0

E13 0

0; (QA-QD+E24); E34; -(E24+E34+QA)

C1 C2 C3 C4 c

-(Wsmoker + QACA)

-(E24+QC) 0 E24

-QBCB -Wgrill 0 b

(QA+EB) 0

-(E13+E34+QA) (QA+E34) A

Substituting the variables into A and b: A= -225 0 25 0 0 125 50 -275 b= -1400 -100 -2000 0

0 -175 225 0

0 -275 25 250

Solving for C1, C2, C3, and C4:

C1= 8.0096 mg/m3

C2= 12.345 mg/m3

C3= 16.897 mg/m3

C4= 16.483 mg/m3

Inverse of A = -0.0049962 -1.5326e-05 -0.00055172 -0.00010728 -0.0034483 -0.0062069 -0.0034483 -0.0034483 -0.00096552 -0.0048276

-0.0049655 -0.00013793 -0.0049655 -0.0048276 -0.00068966 -0.0048276

ii) From the previous question, C2= 12.345 mg/m3

Taking the inverse of the matrix, we can derive each pollution sources contribution to each room: C2, smokers = -a21-1*wsmokers C2, grill = -a23-1*wgrill

C2, air intake = (-a21-1*QACA) + (-a22-1QBCB)

Therefore, % contribution to CO in kids section: From smokers: 27.933% From grill: 55.866%

From air intakes: 16.201%

iii) If smoking was banned in the restaurant and if the grill was fixed, then the air quality in the kids section will improve to 2 mg/m3 of CO. By analysis of the matrix b (external factors), if wsmoker and wgrill = 0, the only contributing factor to pollution is from the air intake (which are both 2 mg/m3). Therefore at steady state, it can be seen that the concentration across all rooms are the same. (Eg: For room 1, the equation reduces to QA*C1 = QA*CA. Hence C1 is equals to CA.) iv) No, this remedy will not help much. The concentration in the kids section will only drop by a little. Reducing the diffusive mixing between the two rooms will not help much, because the pollution is still able to enter the childrens room by air flow. Thus, only by increasing the exhaust volumetric flow (Q D), can the pollution in the childrens room be decreased.

Problem 2
Let A be a matrix containing the information of the pits: A = [0.55 0.30 0.15; 0.25 0.45 0.30; 0.25 0.20 0.55] A = A %the matrix is transposed so that it can be worked upon in the correct format Let C be the requirement of sand, fine gravel and coarse gravel: C = [4800; 5800; 5700] Let B be the volume required from each pit to fulfill C: B = A\C = [2416.7; 9193.3; 4690.0] Thus, 2416.7m3 must be hauled from Pit 1, 9193.3m3 must be hauled from Pit 2, and 4690m3 must be hauled from Pit 3.

Problem 3
function C = my_mm(A,B) % The function my_mm(A,B) takes two matrices A and B as inputs and % performs matrix multiplication on each other. If A is a ixj matrix and B % is a jxk matrix, the output will return an ixk matrix. % Note: The dimensions of the matrices have to be appropriate. The number % of columns of A have to be the same as the number of rows of B.

%% Error message to reject inputs of matrices that cannot be multiplied together checkA = size(A); checkB = size(B); if ~(checkA(2)==checkB(1)) error('Wrong matirx size. The number of columns of A must be the same as the number of rows of B.') end

%% Defining the number of rows and columns of input matrices A and B sizeA = size(A); sizeB = size(B); sum = 0; z = 1; % sum will be the sum of each instance of multiplication of the (i)th row of A and (k)th column of B. z is the index of the output matrix ans, starting from 1. C = ones(sizeA(1),sizeB(2)); %% The main 3 for loops % For any index of A, it is known as a(i,j), and for any index of B, it is % known as b(j,k) for k = 1:sizeB(2) for i = 1:sizeA(1) for j = 1:sizeA(2) sum = A(i,j)*B(j,k) + sum; end C(z) = sum; % this is to fill in the (z)th index of the output matrix z = z+1; % this is to move to the next index of the ouput matrix sum = 0; % this is to reset the sum calculated from the previous iteration of j end end

You might also like