You are on page 1of 4

Name: Almohjili, Mohammad LBYME2E Section: EE1

Ex 3 Learning Outcomes

 LO1 Define and explain the MATLAB functions.


 LO2 Explain and differentiate the difference of analytical and numerical solutions using MATLAB.
 LO3 Perform the different operations involving matrices.
 LO4 Apply computer programming in solving different mathematical problems.
 LO7 Solve engineering problems involving different numerical methods

Topics: Script files, Gaussian Elimination

Type your syntax after each number. Take a screenshot of your workspace after doing all the items

1. EXAMPLE. Fearful of a bank failure, Norman split his life savings of $60,000 among three banks.
He received 5%, 6%, and 7% on the three deposits. In the account earning 7% interest, he
deposited twice as much as in the account earning 5% interest. If his total earnings were $3,760,
then how much did he deposit in each account? (Using Excel)

2. A small manufacturing plant makes three types of inflatable boats: one-person, two-person, and
four-person models. Each boat requires the services of three departments, as listed in the table.
The cutting, assembly, and packaging departments have available a maximum of 380, 330, and
120 labor-hours per week, respectively. How many boats of each type must be produced each
week for the plant to operate at full capacity? Create a Matlab script that outputs the final
augmented matrix using gaussian elimination and the answer in the following variables
(1p_boat, 2p_boat, 4p_boat)

3.
Department One-person boat Two-person boat Four-person boat
Cutting 0.5 hr 1.0 hr 1.5 hr
Assembly 0.6 hr 0.9 hr 1.2 hr
Packaging 0.2 hr 0.3 hr 0.5 hr

4. Create a Matlab script that does Gaussian Elimination on the following system of linear
equations.
a+ b−2 c +d +3e−f =42 a−b+c +2 d +e−3 f =20a+ 3 b−3 c−d+ 2e+ f =−15
5 a+2 b−c−d+2e +f =−3−3 a−b+2 c +3 d +e+ 3 f =164 a+3 b+ c−6 d−3e-2 f =−27

Verify your answer using the linsolve function or matrix inverse. The script must have the
following outputs

a. The final augmented matrix (Mat_3)


b. The answers in its own variable (a, b, c, d, e, f)
c. The answers from verification in a single column matrix named (v_ans)
mat3=[1 1 -2 1 3 -1 4; 2 -1 1 2 1 -3 20; 1 3 -3 -1 2 1 -15; 5 2 -1 -1
2 1 -3; -3 -1 2 3 1 3 16; 4 3 1 -6 -3 -2 -27];
mat3(2,:)= mat3(1,:)*2-mat3(2,:)
mat3(3,:)=mat3(1,:)-mat3(3,:)
mat3(4,:)=mat3(1,:)*5-mat3(4,:)
mat3(5,:)=mat3(1,:)*-3-mat3(5,:)
mat3(6,:)=mat3(1,:)*4-mat3(6,:)
mat3(3,:)=mat3(2,:)*2-mat3(3,:)*-3
mat3(4,:)=mat3(2,:)-mat3(4,:)
mat3(5,:)=mat3(2,:)*-2-mat3(5,:)*3
mat3(6,:)=mat3(2,:)-mat3(6,:)*3
mat3(4,:)=mat3(3,:)*4-mat3(4,:)*-7
mat3(5,:)=mat3(3,:)*2-mat3(5,:)*7
mat3(6,:)=mat3(3,:)*22+mat3(6,:)*7
mat3(5,:)=mat3(4,:)*114-mat3(5,:)*18
mat3(6,:)=mat3(4,:)*78-mat3(6,:)*18
mat3(6,:)=mat3(5,:)*-420-mat3(6,:)*1596
f=mat3(6,7)/mat3(6,6)
e=(-462-(f*3654))/1596
d=(-113-(f*33)+(e*4))/-18
c=(33+(f*4)-(e*13)-(d*6))/-7
b=(-12-f-(e*5)+(c*5))/3
a=(4+f-(e*3)-d+(c*2)-b)
B=[a;b;c;d;e;f]
Ans=[1 1 -2 1 3 -1; 2 -1 1 2 1 -3; 1 3 -3 -1 2 1; 5 2 -1 -1 2 1;
-3 -1 2 3 1 3; 4 3 1 -6 -3 -2;]
Equals=[4;20;-15;-3;16;27]
v_ans=linsolve(Ans,Equals)

You might also like