A REPORT ON SOLVING TRUSSES USING MATLAB Group 1
A REPORT ON SOLVING TRUSSES USING MATLAB Group 1
A REPORT ON SOLVING TRUSSES USING MATLAB Group 1
FACULTY OF ENGINEERING
DEPARTMENT OF CIVIL ENGINEERING
Course name : Computer Application
Submitted to : L. kanock
Submitted by : Group 1
Zainab Mofat BCES/19/SS/010
Innocent Kalonda BCET/17/SS/006
Justina Botha BCET/19/SS/001
Stock Msowoya Becew/19/SS/007
Introduction
In this report we are going to explain how to solve a truss problem using Matlab. The diagram
below is the truss problem that was assigned to our group.
F G H
b
A E
B C D
a a a a
p q r
Procedure
1. We analyzed the truss manually first in order to establish the equations. In this particular
truss there were 8 joints, therefore we established 16 equations and 16 unknown variables
which included both member forces and reactions as follows;
F G H
b
𝐴𝑥
A B C D E
𝐴𝑦 a a a a 𝐸𝑦
p q r
Figure 2: Free body diagram of the truss
1. At joint A F 2. At joint B 𝐹
c b
𝐴𝑥 a
𝑐= 𝑎2 + 𝑏 2 B
𝐴 𝐴 𝐶
B
𝐹𝑥 = 0+ 𝐴𝑦 𝑝
𝑎
𝐹𝑥 = 0+
𝐹𝐴𝐵 + 𝑐 𝐹 − 𝐴𝑥 = 0 (𝑖)
𝐴𝐹 𝐹𝐵𝐶 − 𝐹𝐴𝐵 = 0 (𝑖𝑖𝑖)
𝐹𝑦 = 0+↑
𝑎 𝐹𝑦 = 0+↑
𝐹𝐴𝐵 + 𝐹𝐴𝐹 − 𝐴𝑥 = 0 (𝑖𝑖) 𝐹𝐵𝐹 − 𝑝 = 0 (𝑖𝑣)
𝑐
3. At joint C F H 4. At joint D 𝐻
b c c b
a a
𝐵 𝐴
D
𝐶 𝐸
𝐹𝑥 = 0+ 𝑞 𝐹𝑥 = 0+ D
𝑎 𝑎 𝑟
𝐹𝐶𝐷 + 𝑐 𝐹 −𝑐𝐹 − 𝐹𝐵𝐶 = 0 (𝑣) 𝐹𝐷𝐸 −𝐹𝐶𝐷 = 0 (𝑣𝑖𝑖)
𝐶𝐻 𝐹𝐶
𝐹𝑦 = 0+↑
𝐹𝑦 = 0+↑
𝐹𝐷𝐻 − 𝑟 = 0 (𝑣𝑖𝑖𝑖)
𝑏 𝑏
𝐹𝐶𝐺 + 𝐹𝐹𝐶 + 𝐹𝐶𝐻 − 𝑞 = 0 (𝑣𝑖)
𝑐 𝑐
5. At joint E 6. At joint F F G
F H
b c c b b c
c b
a a a a
𝐵 𝐴
D
𝐹𝑥 = 0+ A C
𝑞 𝐹𝑥 = 0+ B
𝑎
−𝐹𝐷𝐸 + 𝑐 𝐹 =0 (𝑖𝑥) 𝑎 𝑎
𝐸𝐻 𝐹𝐹𝐺 + 𝑐 𝐹 −𝑐𝐹 =0 (𝑥𝑖)
𝐹𝐶 𝐴𝐹
𝐹𝑦 = 0+↑
𝐹𝑦 = 0+↑
𝑏
𝐹 + 𝐸𝐶𝐻 = 0 (𝑥) 𝑏 𝑏
𝑐 𝐸𝐻 − 𝐹𝐵𝐹 − 𝐹𝐹𝐶 − 𝐹𝐴𝐹 = 0 (𝑣𝑖𝑖)
𝑐 𝑐
7. At joint G
F G H 8. At joint H H
G
c b b c
a a
𝐹𝑥 = 0+
C C E
𝑎
𝐹𝐺𝐻 − 𝑐 𝐹 =0 (𝑥𝑖𝑖𝑖) 𝐹𝑥 = 0+ D
𝐹𝐺
𝑎 𝑎
𝐹𝑦 = 0+↑ 𝐹𝐸𝐻 − 𝑐 𝐹𝐶𝐻 − 𝐹𝐺𝐻 = 0 (𝑥𝑣)
𝑐
𝑏 𝑏
− 𝐹𝐷𝐻 − 𝐹𝐶𝐻 − 𝐹𝐸𝐻 = 0 (𝑥𝑣𝑖)
𝑐 𝑐
2. Then we created a script in matlab that was responsible for solving the truss problem
when a user enters the known parameter of the truss which were the external forces and
dimensions.
3. We prompted the user to enter the values of distances a, b and external forces p, q, r
shown in the code below.
4. Afterwards, we created a zero matrix of 16 by 16, then we used matrix indexing to create
the matrix for A.
5. Then we created another zero matrix of 16 by 1 then used matrix indexing to add the
values of p, q, r in the matrix B.
6. We then put the command for matrix to do the reversed division method as shown below.
7. The figure below shows the creation of matrices in the general form: Ax = B.
A x B
1 0 0 0 0 0 0 0 0 0 0 0 0 −1 0 0 𝑥1 0
0 𝑎/𝑐 0 0 0 0 0 0 0 0 0 0 0 0 1 0 𝑥2 0
−1 𝑏/𝑐 1 0 0 0 0 0 0 0 0 0 0 0 0 0 𝑥3 0
0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 𝑥4 𝑝
0 0 −1 0 1 𝑎/𝑐 −𝑎/𝑐 0 0 0 0 0 0 0 0 0 𝑥5 0
0 0 0 0 0 𝑏/𝑐 𝑏/𝑐 1 0 0 0 0 0 0 0 0 𝑥6 𝑞
0 0 0 0 −1 0 0 0 1 0 0 0 0 0 0 0 𝑥7 0
0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 𝑥8 𝑟
0 0 0 0 0 0 0 0 −1 0 −𝑎/𝑐 0 0 0 0 0 𝑥9 = 0
0 0 0 0 0 0 0 0 0 0 𝑏/𝑐 0 0 0 0 1 𝑥10 0
0 −𝑎/𝑐 0 0 0 0 𝑎/𝑐 0 0 0 0 1 0 0 0 0 𝑥11 0
0 −𝑏/𝑐 0 −1 0 0 −𝑏/𝑐 0 0 0 0 0 0 0 0 0 𝑥12 0
0 0 0 0 0 0 0 0 0 0 0 −1 1 0 0 0 𝑥13 0
0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 𝑥14 0
0 0 0 0 0 −𝑎/𝑐 0 0 0 0 𝑎/𝑐 0 −1 0 0 0 𝑥15 0
0 0 0 0 0 −𝑏/𝑐 0 0 0 −1 −𝑏/𝑐 0 0 0 0 0 𝑥16 0
8. Then we wrote a code that was responsible for displaying the solutions of the matrix that
is the member forces and reactions. Here we used fprintf feature in maltab. The diagram
below shows how we displayed the solutions.
9. Lastly, we successfully run the program and the results of the truss problem were
displayed as we intended them to. The diagram below shows the results after running the
program.
Challenges faced and solutions
1. Limited access to computers with Matlab. To mitigate this problem we used the computer
laboratory to do the whole of our assignment.
2. Our first program had a lot of errors so it did not run hence we had to redo the code until
it run successfully.
Conclusion
After following all the procedures above, the program was tested and it runs as expected
provided that the user inputs valid inputs upon being prompted.