Lab 02 Task
Task1. Compute the values of x using inverse method
x + y=5,
2x+y=4,
Code:
1. A=[1 1;2 -1];
2. B=[5;4];
3. x=inv(A)*B
4. disp('Solution[x,y]=')
5. disp(x)
Task 01
Task 2. Compute X
x + y + z + w = 10
2x – y + 3z + w = 5
-x + 4y + z - w = 2
3x + y – z + 2w = 7
Code:
1. A=[1 1 1 1;2 -1 3 1;-1 4 1 -1;3 1 -1 2];
2. B=[10;5;2;7];
3. x=inv(A)*B
4. disp('Solution[x,y]=')
5. disp(x)
Task 02
Task 3. Compute X using inverse and division method
x1+ x2-x3+x4+x5+x6 = 12
2x1-x2+x3+2x4-x5+x6 = 5
-x1+3x2+2x3-x4+x5 = 7
x1+x2+x3+x4+x5+x6 = 20
2x1-2x2+x3+3x4-x5-x6 = 9
x1+4x2-x3+2x4+x5+x6 = 15
Code:
1. A=[1 2 -1 1 1 1;2 -1 1 2 -1 1;-1 3 2 -1 1 0;1 1 1 1 1 1;2 -2 1 3 -1 -1;1
4 -1 2 1 1];
2. B=[12;15;7;20;9;15];
3.
4. x=A\B
5.
6. disp('Solution[x1,x2,x3,x4,x5,x6]=')
7. disp(x)
8.
9. disp(det(A))
10.
11. b=A*x
Task 03
Task 4. The Torque transmitted by a solid circular shaft is given by
pi 3
T= ∗τ∗d
16
τ = Shear stress (Pa)
d = Diameter (m)
A steel shaft has allowable shear stress = 40 x 106 pa and diameter d= 0.05m. Find the
maximum torque it can transmit.
Code:
1. d=0.05;
2. shearstress=40*10^6;
3. T=pi/16*shearstress*d^3
4. disp(T)
Task 04
Task 5. A simply supported beam of span L=10 m carries a uniform load w=5kN/m.
The bending moment along the beam is:
w
M= (L−x)
2
0≤ x≤ L
Code:
1. x=[Link];
2. w=5000;
3. L=10;
4. M=w/2*(L-x)
5. plot(M,x)
Task 05
Task 6. Plot linear Stress-strain up to yield point;
σ =E∗ε
E = 200 x 10 pa
0 ≤ x ≤ 0.002
Code
1. strain=0:0.001:0.002;
2. stress=200*10^9
3. sigma=stress*strain
4. plot(sigma,strain)
Task 06