0% found this document useful (0 votes)
317 views42 pages

Planar Trusses Solution Via Numerical Method

To find a solution of planar trusses by using one of the method in numerical method and run it in the software.

Uploaded by

Izzaty Roslan
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
317 views42 pages

Planar Trusses Solution Via Numerical Method

To find a solution of planar trusses by using one of the method in numerical method and run it in the software.

Uploaded by

Izzaty Roslan
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 42

APPLIED NUMERICAL

METHOD
SKMM3032

PROJECT REPORT
“PLANAR TRUSSES”
NAME : NURIZZATI BINTI ROSLAN
IC NUMBER : 951105016716
MATRIC NUMBER : A14KM0176
SECTION :7
FACULTY : FACULTY OF MECHANICAL ENGINEERING
LECTURER’S NAME : DR MASTURA BINTI ABDUL WAHID

0
CONTENT

1.0 INTRODUCTION 2
2.0 OBJECTIVES 3
3.0 PROBLEM STATEMENTS 4
4.0 MATLAB: LU DECOMPOSITION METHOD 6
5.0 MATLAB: GAUSS ELIMINATION METHOD 8
6.0 METHODOLOGY 9
6.1 ALGORITHM 9
6.2 FLOWCHART 14
7.0 RESULTS 16
8.0 ANALYSIS AND DISCUSSIONS 17
8.1 VERIFICATION PROCESS 17
8.2 EXPECTED RESULT 20
8.3 COMPARISON OF CHOSEN METHOD 22
9.0 CONCLUSION 25
10.0 REFERENCES 26
APPENDIX 27

1
1.0 INTRODUCTION
“Trusses” is one of the engineering analysis that involves a lot of calculation.
A truss can be defined as a structure that is composed of slender members, which is two-force-
members, joined together at their end points. Joints are modelled by smooth pin connections.
The trusses members are either under tension due to tensile force or compression due to
compressive load. Trusses are used extensively in building such as airport terminal and aircraft
hangar which required really long span. Pylon tower and bridge are also the application of the
planar trusses. The purposes of using trusses are to provide longitudinal stability and carry the
load that is applied to them.

During the analysis of trusses, when all the trusses members are in one plane, it
is called planar. In this report, we are going to solve a problem which related to planar trusses.
The basic element in planar trusses is the triangle shape made up of 3 members. The 3 members
are joined by pins at their ends constitute a rigid frame. In this case, the structures are extended
about another 8 members that formed 5 rigid triangle shape. Since the length of each member
are the same, hence this trusses are in geometrically similar, which means if the trusses having
the same external load applied, the forces at each member are the equal. In this case, there is
only load for the vertical axis and zero force on the horizontal axis.

Another important concept that we need to look close is either the trusses is in
statically determinate or indeterminate. A truss is said to be rigid and statically determinate,
when the number of members, m along with the number of joints, j satisfies the equation of
𝑚 = 2𝑗 − 3, while if the truss is statically indeterminate it will gives the results as 𝑚 < 2𝑗 − 3
and 𝑚 > 2𝑗 − 3. During analysis of statically determinate, the static equilibrium equation is
sufficient for determining the internal forces and the reaction of the structures, while in
statically indeterminate, the static equilibrium equation is not enough to determine the internal
forces as well as the reaction of each member.

In engineering world, there are many ways to solve problem related to planar
trusses. One that we are going to show in detail is using matrix method.

2
2.0 OBJECTIVES
In this project, there is few objectives that we need to archive throughout the project.
These objectives act as the guidance to complete the requirements needed in this project.

1. To solve problem related to trusses using matrix form;


2. To calculate the value of displacement of each member;
3. To analyse the displacement;
4. To compare the chosen method;
5. To calculate the value of buckling of certain member;
6. To analyse the value of buckling.

3
3.0 PROBLEM STATEMENTS
In this report, we were asked to calculate the displacement of each member
when certain load is applied to them and the buckling at certain members. The Figure 1 shows
the arrangement of the planar trusses. The details are shown as below;

Figure 1: Planar Trusses

For member 1,2,3,4 and 5:

Outer Diameter: 1 in

Inner Diameter: 0.78 in

For member 6,7,8,9,10 and 11:

Outer diameter: 2 in

Inner Diameter: 1.8 in

For member 1,3,5,6,7

Load: 0

4
For member 2,4,6,8,10

Load: -1000 lb

Modulus Young, E: 30x106 psi

Length: 30 in

Based on the arrangement of the planar trusses, it is involving up to 10


unknowns which gives 10 equilibrium static equations. The equation is given by the form of
matrix I the terms of area of each member.

5
4.0 MATLAB: LU DECOMPOSITION METHOD
In many applications where linear systems appear, one needs to solve Ax = b
for many different vectors b. For instance, a structure must be tested under several different
loads, not just one. As in the example of a truss, the loading in such a problem is usually
represented by the vector b. Gaussian elimination with pivoting is the most efficient and
accurate way to solve a linear system. Most of the work in this method is spent on the matrix
A itself. If we need to solve several different systems with the same A, and A is big, then we
would like to avoid repeating the steps of Gaussian elimination on A for every different b. This
can be accomplished by the LU decomposition, which in effect records the steps of Gaussian
elimination.
The main idea of the LU decomposition is to record the steps used in Gaussian
elimination on A in the places where the zero is produced. If we also include pivoting, then an
LU decomposition for A consists of three matrices P, L and U such that

P A = LU.

The pivot matrix P is the identity matrix, with the same rows switched as the rows of A are
switched in the pivoting. For instance,

1 0 0
P = [0 0 1]
0 1 0

would be the pivot matrix if the second and third rows of A are switched by pivoting. Matlab
will produce an LU decomposition with pivoting for a matrix A with the command

> [L U P] = lu(A)

where P is the pivot matrix. To use this information to solve Ax = b we first pivot both sides
by multiplying by the pivot matrix:

P Ax = Pb ≡ d.

Substituting LU for P A we get

LUx = d.

6
Then we need only to solve two back substitution problems:

Ly = d

and

Ux = y.

7
5.0 MATLAB: GAUSS ELIMINATION METHOD
Engineers often need to solve large systems of linear equations; for example, in
determining the forces in a large framework or finding currents in a complicated electrical
circuit. The method of Gauss elimination provides a systematic approach to their solution. This
method also is the easiest method to be done. The reason why this system was easy to solve is
that the system was "triangular"; this refers to the equations having the form of a triangle,
because of the lower equations containing only the later variables. When we have form a matrix
with lower or upper triangular, we can easily calculate the unknown by using back substitution.
Hence we get the value of unknown straight away.

There are few methods to get the triangular matrix, for example, in this planar trusses
analysis, we are using Gauss Elimination with Pivoting element. What is mean by pivoting
element? The "pivot" or "pivot element" is an element on the left hand side of a matrix that we
want the elements above and below to be zero. Pivoting works because a common multiple of
two numbers can always be found by multiplying the two numbers together. There is way on
selecting pivot element. First, pick the column with the most zeros in it. Use a row or column
only once and pivot on a one if possible. Next, we should pivot on the main diagonal. The most
important is never pivot on a zero as the calculation will be invalid. Last but not least, never
pivot on the right hand side.

The advantages of using Gauss Elimination is the method is used in finding the inverse
of a matrix and to compute ranks and bases. While the disadvantages are the method does not
generalize in any simple way to higher order tensors and computing the rank of a tensor of
order greater than 2 is a difficult problem. The general equation for Gauss Elimination is

8
6.0 METHODOLOGY

6.1 ALGORITHM
6.1.1 ALGORITHM FOR LU DECOMPOSITION

1. Start
2. Clarify the known parameter and assign their values

𝑙, 𝑂𝐷𝑖, 𝐼𝐷𝑖, 𝑂𝐷𝑗, 𝐼𝐷𝑗, 𝐸

3. Calculate the value for Ai and Aj by using loop for;

for Ai = ((ODi/2)*(ODi/2)*pi)- ((IDi/2)*(IDi/2))*pi;


Aj = ((ODj/2)*(ODj/2)*pi)- ((IDj/2)*(IDj/2))*pi;
End

4. Displayed the value of Ai and Aj


5. Write the matrix A which is 10 by 10 matrix
6. Calculate the value of matrix b by using the formula given.

b = ((4*l)/E)*[ Pj; Pi; Pj; Pi; Pj; Pi; Pj; Pi; Pj; Pi;];
b
7. Displayed the matrix b.
8. Clarify the number of row and column for matrix A

n=size (A,1);

9. Clarify the matrix L, 10 by 1 zero matrix

L=zeros(n);

10. Clarify the matrix U, 10 by 1 zero matrix

U=zeros(n);

9
11. Start loop for with j-k:n

for k=1:n
for j=k:n
U(k,j)=A(k,j)-L(k,1:k-1)*U(1:k-1,j);
end;

12. End loop


13. Repeat loop with i=k+1:n

L(k,k)=1;
for i=k+1:n
L(i,k)=(A(i,k)-L(i,1:k-1)*U(1:k-1,k))/U(k,k);
end

14. End loop


15. Clarify vector V

v=zeros(n,1);
v(1)=b(1)/L(1,1);

16. Initiate the vector V for forward substitution


17. Start the loop by assign vector i=2:n

for i=2:n
v(i)=(b(i)-L(i,1:i-1)*v(1:i-1))/L(i,i);
end

18. End loop


19. Clarify the matrix x

x=zeros(n,1);
x(n)=v(n)/U(n,n);

10
20. Initiate the backward substitution
21. Start loop for i=n-1:-1:1

for i=n-1:-1:1
x(i)=(v(i)-U(i,i+1:n)*x(i+1:n))/U(i,i);
end

22. End loop


23. Print the result

11
6.1.2 ALGORITHM FOR GAUSS ELIMINATION

1. Denote the function as Gauss Elimination


2. Clarify the known parameter and assign their values

𝑙, 𝑂𝐷𝑖, 𝐼𝐷𝑖, 𝑂𝐷𝑗, 𝐼𝐷𝑗, 𝐸

3. Calculate the value for Ai and Aj

for Ai = ((ODi/2)*(ODi/2)*pi)- ((IDi/2)*(IDi/2))*pi;


Aj = ((ODj/2)*(ODj/2)*pi)- ((IDj/2)*(IDj/2))*pi;
End
4. Displayed the value of Ai and Aj
5. Write the matrix A which is 10 by 10 matrix
6. Calculate the value of matrix B

b = ((4*l)/E)*[ Pj; Pi; Pj; Pi; Pj; Pi; Pj; Pi; Pj; Pi;];
b
7. Display as 10 by 1 matrix
8. Clarify the number of row and column for matrix A
-Find size of matrix A
9. Clarify the number of row and column for matrix b
-Find size of matrix b
10. Initialize the matrix x
11. Start the loop with i=1:n-1
12. Clarify the multipliers, m
13. Do for A and b using loop for

for i = 1:n-1
m = -A(i+1:n,i)/A(i,i); % multipliers
A(i+1:n,:) = A(i+1:n,:) + m*A(i,:);
b(i+1:n,:) = b(i+1:n,:) + m*b(i,:);
end;

14. End loop

12
15. Proceed with back substitution
16. Clarify matrix x

x(n,:) = b(n,:)/A(n,n);

17. Start loop with i=n-1:-1:1


18. Do for x

for i = n-1:-1:1
x(i,:) = (b(i,:) - A(i,i+1:n)*x(i+1:n,:))/A(i,i);
end
19. End loop
20. Print the result

13
6.2 FLOWCHART
6.2.1. FLOWCHART FOR LU DECOMPOSITION

14
6.2.2. FLOWCHART FOR GAUSS ELIMINATION

15
7.0 RESULTS

LU Decomposition Gauss Elimination Error (%)


X1 0.0467 0.0467 0
X2 -0.0276 -0.0276 0
X3 0.0475 0.0475 0
X4 -0.0548 -0.0548 0
X5 0.0565 0.0565 0
X6 -0.02 -0.02 0
X7 0.0189 0.0189 0
X8 -0.0421 -0.0421 0
X9 0.0332 0.0332 0
X10 -0.057 -0.057 0

Second Moment of Area, I:

I = 0.03091766 in4

Critical Buckling, Pcr:

𝑃𝑐𝑟 = 1.0172 × 104

Load truss for member 6,4 and 5

Load = 866.0254 psi

Load truss for member 11

Load = 0

16
8.0 ANALYSIS AND DISCUSSIONS

8.1 VERIFICATION PROCESS


For verification process we are using another small size matrix as our new matrix. The
linear equation is shown below;

x + y + z = 6

2y + 5z = -4

2x + 5y - z = 27

Hence the matrix A and B is given by;

1 1 1
A = [0 2 5 ]
2 5 −1

6
B = [−4]
27

We are using the inverse matrix to solve this linear equation problem. We can call the
matrices "A", "X" and "B" and the equation becomes:

AX = B

Where;

A is the 3x3 matrix of x, y and z coefficients

X is x, y and z, and

B is 6, -4 and 27

17
8.1.1 Verification for LU Decomposition

1 1 1
Since our matrix is 𝐴 = [0 2 5 ], first we need to calculate for matrix L and U by
2 5 −1
using Gauss Elimination method. Let start with matrix L, matrix U is the upper triangular
matrix. In this case, we are using gauss elimination with pivoting element to find L and U.
First, we take our row 1 as pivoting element to change value for n = 2,3 m = 1 as zero.

1 1 1
𝐴 = [0 2 5]
2 5 −1

−2𝑅1 + 𝑅3

1 1 1
𝑈 = [0 2 5]
0 3 −3

−3𝑅1/2 + 𝑅3

1 1 1
𝑈 = [0 2 5 ]
0 0 −10.5

Next we proceed with matrix L which is the lower triangular matrix

1 1 1
𝐴 = [0 2 5]
2 5 −1

With the same method, we will get the value for L as below

1 0 0
𝐿 = [0 1 0]
2 1.5 1

18
To find the value X, by using the formula X = L-1U-1B

1 0 0 −1 1 1 1 −1 6
X = [0 1 0] [0 2 5 ] [−4]
2 1.5 1 0 0 −10.5 27

Hence the value for X is as below;

5
𝑋=[ 3 ]
−2

8.1.2 Verification for Gauss Elimination

Since we have been doing the Gauss Elimination while we’re calculating for LU
Decomposition, hence we’ve explaining some part of the Gauss Elimination. Let just proceed
to

1 1 1 6
𝐴 = [⟨0 2 5 |−4⟩]
2 5 −1 27

−𝑅1 + 𝑅3

1 1 1 6
𝐴 = [⟨0 2 5 |−4⟩]
0 3 −3 15
3𝑅1
− + 𝑅3
2

1 1 1 6
𝐴 = [⟨0 2 5 |−4⟩]
0 0 −10.5 21

Hence, when we proceed to back-ward substitution, we can get the value of X directly.

5
𝑋=[ 3 ]
−2

After we have done the verification process, we can conclude that using LU
Decomposition and Gauss Elimination method can be used to calculate either small size matrix
and large size matrix. This is because the value of X for both method is the same, while the
value of X for planar trusses are also the same. In other words, the value of X for planar trusses
can be accepted and it is almost to the exact value.

19
8.2 EXPECTED RESULT

Expected Value Calculated Value Error (%)


X1 0.0466 0.0467 0.214592275
X2 -0.0276 -0.0276 0
X3 0.0474 0.0475 0.210970464
X4 -0.0547 -0.0548 0.182815356
X5 0.0565 0.0565 0
X6 -0.02 -0.02 0
X7 0.0188 0.0189 0.531914894
X8 -0.0421 -0.0421 0
X9 0.0331 0.0332 0.302114804
X10 -0.0569 -0.057 0.175746924

Based on the matrix A and b, we perform another method to calculated our


expected value of x. The general equation is;

𝑥 = 𝐴−1 𝑏

Where:

A-1 is the inverse matrix of A

X is the unknowns

After we have performed the method in matlab, the result is as the table above. As we
can see the relative error is less than 1%. The proved that the calculated value is acceptable due
to small relative error.

20
21
8.3 COMPARISON OF CHOOSEN METHOD
In general, Gauss Elimination is easier to do compared to LU Decomposition. Since we
have the same result, this is mean that the relative error is zero between the two method. This
is means that both methods are compatible to be used for this planar trusses analysis. Through
the observation made, the error can be reduced by changing the square root function to a rigid
value which is 0.5. If we denoted the square root function as ½ it will give quite slightly
different answer.

The reason why we choose the second method which is Gauss Elimination is simply
because it required a short time to perform the calculation. During LU Decomposition, after
getting Upper Triangular Matrix, we need to find the Lower Triangular Matrix then only we
can solve using X = L-1U-1B. LU Decomposition required lot of calculation and percentage of
doing mistakes is high compare to Gauss Elimination.

When we were using Gauss Elimination, we only required one triangular matrix and
we can directly calculate for the unknown by using back substitution. That is why the Gauss
Elimination only required short time, while the percentage of making mistake is less than LU
Decomposition.

22
8.4 BUCKLING ANALYSIS
In the analysis of buckling, first we need to calculate the first moment of area, I.

Below is the calculation of I.


π
I= (ODi4 − IDi4 )
64

π
I= (14 − 0.784 )
64

I = 0.03091766 𝑖𝑛4

Calculation of the Pcr

𝜋2 𝐸𝐼
𝑃𝑐𝑟 =
𝑙2

𝜋2 ×30𝐸6×0.0309176
𝑃𝑐𝑟 =
302

𝑃𝑐𝑟 = 1.0172 × 104

Calculation of 𝜃

15
𝜃 = 90 − cos −1 [30]

√3
𝜃= 2

Calculation of load truss

Load = Load x 𝜃

Load = 866.0254 psi

23
We know that if 𝐵𝑢𝑐𝑘𝑙𝑖𝑛𝑔 > 𝑃𝑐𝑟 the truss member will fail. From the analysis of the
buckling, we have found that the buckling of each member is less than the value of Pcr. Thus
all the member will not fail.

∴ 𝑇ℎ𝑒 𝑙𝑜𝑎𝑑 𝑡𝑟𝑢𝑠𝑠 𝑓𝑜𝑟 𝑚𝑒𝑚𝑏𝑒𝑟 6,4,5 𝑎𝑛𝑑 11 𝑖𝑠 866.0254 𝑝𝑠𝑖.

∴ 𝑇ℎ𝑢𝑠 𝑡ℎ𝑒 𝑚𝑒𝑚𝑏𝑒𝑟𝑠 𝑤𝑖𝑙𝑙 𝑛𝑜𝑡 𝑓𝑎𝑖𝑙

24
9.0 CONCLUSION
In this project we can conclude that the value of displacement of each member is
positive which is the member is having tensile stress due to the load applied to them. After we
have analyse for each method, we have found that each of the method have their advantages
and disadvantages. In order to find their differences, we can calculate for each relative error.
Relative error indicates how much one’s method differ from the other. Another method to find
the error of any method is to calculate the exact value by using analytical method.

Since we are using matrix method to solve most of the problem in this project, we have
to look for the reliability analysis of truss structures using matrix method. The resulting
criterion for a statically determinate truss is simple and its failure probability is easily
evaluated. In case of a statically indeterminate truss, however, there are many possible modes
or paths to complete failure of the structure and it is impossible in practice to generate all of
them.

Hence, the failure probability is estimated by evaluating its lower and upper bounds.
The lower bound is evaluated by selecting the dominant modes of failure and calculating their
probabilities. The upper bound is evaluated by assuming that the redundant truss behaves itself
like a statically determinate truss, i.e., the structure fails if any one member is subject to failure.
Numerical examples are provided to demonstrate the applicability of the proposed methods.

25
10.0 REFERENCES
Che Rahim Che The. (2009) Numerical method algorithm and Matlab programming. UTM
Press

Hoffman, J. D. (1992). Numerical Methods for Engineers and Scientist (2nd ed.). Basel, New
York: McGraw-Hill.

Penny, J. E., & Lindfield, G. R. (2000). Numerical methods using Matlab. Upper Saddle River,
NJ: Prentice Hall.

Steven C. Chapra & Raymond P. Canale. (2010) Numerical Methods for Engineers(6th ed.)
New York: Mc Graw-Hill.

26
APPENDIX

27
CODING FOR LU DECOMPOSITION
% Area of trusses 1,2,3,4 and 5 is denoted as Ai
% Area of trusses 6,7,8,9,10 and 11 is denoted as Aj

% List out all the data needed in the calculation

% Outer Diameter and Inner Diameter


ODi = 1;
IDi = 0.78;
ODj = 2;
IDj = 1.8;

% Modulus Young, E
E = 30*10^6;

% Length
l = 30;

% Load for truss 2,4,6,8 and 10 is denoted as Pi


% Load for truss 1,3,5,7, and 9 is denoted as Pj
Pi = -1000;
Pj = 0;

% Calculation of Area Ai and Aj


% Value of Areas will be displayed on the output
for Ai = ((ODi/2)*(ODi/2)*pi)- ((IDi/2)*(IDi/2))*pi;
Aj = ((ODj/2)*(ODj/2)*pi)- ((IDj/2)*(IDj/2))*pi;
end

% The value of both area is displayed as followed


Ai
Aj

% Since we're following the equation of [A]x = b , hence we need to clarify all the parameter needed.
% The matrix A is written as below
A = [ (4*Ai+Aj+Aj) 3^0.5*(Aj-Aj) -4*Ai 0 0 0 -Aj 3^0.5*(Aj)
0 0;

28
3^0.5*(Aj-Aj) 3*(Aj+Aj) 0 0 0 0 3^0.5*(Aj) -3*Aj 0
0;
-4*Ai 0 (4*Ai+4*Ai+Aj+Aj) 3^0.5*(Aj-Aj) -4*Ai 0 -Aj -3^0.5*Aj
-Aj 3^0.5*Aj ;
0 0 3^0.5*(Aj-Aj) 3*(Aj+Aj) 0 0 -3^0.5*Aj -3*Aj
3^0.5*Aj -3*Aj ;
0 0 -4*Ai 0 (4*Ai+Aj+Aj) 3^0.5*(Aj-Aj) 0 0 -
Aj 3^0.5*Aj ;
0 0 0 0 3^0.5*(Aj -Aj) 3*(Aj+Aj) 0 0 -
3^0.5*Aj -3*Aj ;
-Aj 3^0.5*Aj -Aj -3^0.5*Aj 0 0 (4*Ai+4*Ai+Aj+Aj) -3^0.5*(Aj-
Aj) -4*Ai 0;
3^0.5*Aj -3*Aj -3^0.5*Aj -3*Aj 0 0 -3^0.5*(Aj-Aj) 3*(Aj+Aj)
0 0;
0 0 -Aj 3^0.5*Aj -Aj -3^0.5*Aj -4*Ai 0
(4*Ai+4*Ai+Aj+Aj) -3^0.5*(Aj-Aj) ;
0 0 3^0.5*Aj -3^0.5*Aj 3^0.5*Aj -3*Aj 0 0 -
3*0.5*(Aj-Aj) 3*(Aj+Aj) ; ]

% Calculation for b
% The value of b will be displayed
b = ((4*l)/E)*[ Pj; Pi; Pj; Pi; Pj; Pi; Pj; Pi; Pj; Pi;];
b

% The vector x is the displacements of the trusses at the joints when the load is applied
% Using LU Decomposition method to find the value of x
% Step involved in LU Decomposition

% Step 1 : Find the Upper Matrix (U) and Lower Matrix (L)

n=size (A,1);
L=zeros(n);
U=zeros(n);

for k=1:n
for j=k:n
U(k,j)=A(k,j)-L(k,1:k-1)*U(1:k-1,j);
end;
L(k,k)=1;

29
for i=k+1:n
L(i,k)=(A(i,k)-L(i,1:k-1)*U(1:k-1,k))/U(k,k);
end
end
% The L and U matrix is displayed.
L
U

% Step 2 : Use vector v to solve Lv = B by using forward substituition


v=zeros(n,1);
v(1)=b(1)/L(1,1);
for i=2:n
v(i)=(b(i)-L(i,1:i-1)*v(1:i-1))/L(i,i);
end

% Step 3 : Use x to solve Ux = v by using backward substituition


% x is the displacement of each member
x=zeros(n,1);
x(n)=v(n)/U(n,n);
for i=n-1:-1:1
x(i)=(v(i)-U(i,i+1:n)*x(i+1:n))/U(i,i);
end

% The value of x is displayed as followed


x

30
CODING FOR GAUSS ELIMINATION
function x = Gauss(A, b)
% Area of trusses 1,2,3,4 and 5 is denoted as Ai
% Area of trusses 6,7,8,9,10 and 11 is denoted as Aj

% List out all the data needed in the calculation

% Outer Diameter and Inner Diameter


ODi = 1;
IDi = 0.78;
ODj = 2;
IDj = 1.8;

% Modulus Young, E
E = 30*10^6;

% Length
l = 30;

% Load for truss 2,4,6,8 and 10 is denoted as Pi


% Load for truss 1,3,5,7, and 9 is denoted as Pj
Pi = -1000;
Pj = 0;

% Calculation of Area Ai and Aj


% Value of Areas will be displayed on the output
for Ai = ((ODi/2)*(ODi/2)*pi)- ((IDi/2)*(IDi/2))*pi;
Aj = ((ODj/2)*(ODj/2)*pi)- ((IDj/2)*(IDj/2))*pi;
Ai
Aj
end

% Since we're following the equation of [A]x = b , hence we need to clarify all the parameter needed.
% The matrix A is written as below
A = [ (4*Ai+Aj+Aj) 3^0.5*(Aj-Aj) -4*Ai 0 0 0 -Aj 3^0.5*(Aj)
0 0;
3^0.5*(Aj-Aj) 3*(Aj+Aj) 0 0 0 0 3^0.5*(Aj) -3*Aj 0
0;

31
-4*Ai 0 (4*Ai+4*Ai+Aj+Aj) 3^0.5*(Aj-Aj) -4*Ai 0 -Aj -3^0.5*Aj
-Aj 3^0.5*Aj ;
0 0 3^0.5*(Aj-Aj) 3*(Aj+Aj) 0 0 -3^0.5*Aj -3*Aj
3^0.5*Aj -3*Aj ;
0 0 -4*Ai 0 (4*Ai+Aj+Aj) 3^0.5*(Aj-Aj) 0 0 -
Aj 3^0.5*Aj ;
0 0 0 0 3^0.5*(Aj-Aj) 3*(Aj+Aj) 0 0 -
3^0.5*Aj -3*Aj ;
-Aj 3^0.5*Aj -Aj -3^0.5*Aj 0 0 (4*Ai+4*Ai+Aj+Aj) -3^0.5*(Aj-
Aj) -4*Ai 0;
3^0.5*Aj -3*Aj -3^0.5*Aj -3*Aj 0 0 -3^0.5*(Aj-Aj) 3*(Aj+Aj)
0 0;
0 0 -Aj 3^0.5*Aj -Aj -3^0.5*Aj -4*Ai 0
(4*Ai+4*Ai+Aj+Aj) -3^0.5*(Aj-Aj) ;
0 0 3^0.5*Aj -3^0.5*Aj 3^0.5*Aj -3*Aj 0 0 -
3*0.5*(Aj-Aj) 3*(Aj+Aj) ; ]

% Calculation for b
% The value of b will be displayed
b = ((4*l)/E)*[ Pj; Pi; Pj; Pi; Pj; Pi; Pj; Pi; Pj; Pi;];
b

% The vector x is the displacements of the trusses at the joints when the load is applied
% Using Gauss-Elimination method to get the value of x
n=size(A,1);
L=zeros(n);
U=zeros(n);

% We are using the Gauss Elimination - back subtitution as the second method of analysis
% Solve linear system Ax = b
% using Gaussian elimination without pivoting
% A is an n by n matrix
% b is an n by k matrix (k copies of n-vectors)
% x is an n by k matrix (k copies of solution vectors)

[n, n] = size(A); % Find size of matrix A


[n, k] = size(b); % Find size of matrix b
x = zeros(n,k); % Initialize x
for i = 1:n-1

32
m = -A(i+1:n,i)/A(i,i); % multipliers
A(i+1:n,:) = A(i+1:n,:) + m*A(i,:);
b(i+1:n,:) = b(i+1:n,:) + m*b(i,:);
end;

% Use back substitution to find unknowns


x(n,:) = b(n,:)/A(n,n);
for i = n-1:-1:1
x(i,:) = (b(i,:) - A(i,i+1:n)*x(i+1:n,:))/A(i,i);
end

33
VERIFICATION FOR LU DECOMPOSITION

% Verification process for LU Decomposition

A = [ 1 1 1;
0 2 5;
2 5 -1];

B = [ 6 -4 27];

n=size (A,1);
L=zeros(n);
U=zeros(n);

for k=1:n
for j=k:n
U(k,j)=A(k,j)-L(k,1:k-1)*U(1:k-1,j);
end;
L(k,k)=1;
for i=k+1:n
L(i,k)=(A(i,k)-L(i,1:k-1)*U(1:k-1,k))/U(k,k);
end
end
% The L and U matrix is displayed.
L
U

% Step 2 : Use vector v to solve Lv = B by using forward substituition


v=zeros(n,1);
v(1)=B(1)/L(1,1);
for i=2:n
v(i)=(B(i)-L(i,1:i-1)*v(1:i-1))/L(i,i);
end

34
% Step 3 : Use x to solve Ux = v by using backward substituition
% x is the displacement of each member
x=zeros(n,1);
x(n)=v(n)/U(n,n);
for i=n-1:-1:1
x(i)=(v(i)-U(i,i+1:n)*x(i+1:n))/U(i,i);
end

% The value of x is displayed as followed


x

35
VERIFICATION FOR GAUSS ELIMINATION

function x = Gauss(A, b)
A = [ 1 1 1;
0 2 5;
2 5 -1]

b = [ 6 -4 27]

% Using Gauss-Elimination method to get the value of x


n=size(A,1);
L=zeros(n);
U=zeros(n);

% We are using the Gauss Elimination - back subtitution as the second method of analysis
% Solve linear system Ax = b
% using Gaussian elimination without pivoting
% A is an n by n matrix
% b is an n by k matrix (k copies of n-vectors)
% x is an n by k matrix (k copies of solution vectors)

[n,n] = size(A); % Find size of matrix A


[n,k] = size(b); % Find size of matrix b
x = zeros(n,k); % Initialize x
for i = 1:n-1
m = -A(i+1:n,i)/A(i,i); % multipliers
A(i+1:n,:) = A(i+1:n,:) + m*A(i,:);
b(i+1:n,:) = b(i+1:n,:) + m*b(i,:);
end;

% Use back substitution to find unknowns


x(n,:) = b(n,:)/A(n,n);
for i = n-1:-1:1
x(i,:) = (b(i,:) - A(i,i+1:n)*x(i+1:n,:))/A(i,i);
end
x

36
CALCULATION OF BUCKLING
% Area of trusses 1,2,3,4 and 5 is denoted as Ai
% Area of trusses 6,7,8,9,10 and 11 is denoted as Aj

% List out all the data needed in the calculation

% Outer Diameter and Inner Diameter


ODi = 1;
IDi = 0.78;
ODj = 2;
IDj = 1.8;

% Modulus Young, E
E = 30*10^6;

% Length
l = 30;

% Load for truss 2,4,6,8 and 10 is denoted as Pi


% Load for truss 1,3,5,7, and 9 is denoted as Pj
Pi = -1000;
Pj = 0;

% Calculation of Area Ai and Aj


% Value of Areas will be displayed on the output
for Ai = ((ODi/2)*(ODi/2)*pi)- ((IDi/2)*(IDi/2))*pi;
Aj = ((ODj/2)*(ODj/2)*pi)- ((IDj/2)*(IDj/2))*pi;
end

% The value of both area is displayed as followed


Ai
Aj

% Since we're following the equation of [A]x = b , hence we need to clarify all the parameter needed.
% The matrix A is written as below
A = [ (4*Ai+Aj+Aj) 3^0.5*(Aj-Aj) -4*Ai 0 0 0 -Aj
3^0.5*(Aj) 0 0;

37
3^0.5*(Aj-Aj) 3*(Aj+Aj) 0 0 0 0 3^0.5*(Aj) -3*Aj
0 0;
-4*Ai 0 (4*Ai+4*Ai+Aj+Aj) 3^0.5*(Aj-Aj) -4*Ai 0 -Aj -
3^0.5*Aj -Aj 3^0.5*Aj ;
0 0 3^0.5*(Aj-Aj) 3*(Aj+Aj) 0 0 -3^0.5*Aj -3*Aj
3^0.5*Aj -3*Aj ;
0 0 -4*Ai 0 (4*Ai+Aj+Aj) 3^0.5*(Aj-Aj) 0 0
-Aj 3^0.5*Aj ;
0 0 0 0 3^0.5*(Aj-Aj) 3*(Aj+Aj) 0 0 -
3^0.5*Aj -3*Aj ;
-Aj 3^0.5*Aj -Aj -3^0.5*Aj 0 0 (4*Ai+4*Ai+Aj+Aj) -
3^0.5*(Aj-Aj) -4*Ai 0;
3^0.5*Aj -3*Aj -3^0.5*Aj -3*Aj 0 0 -3^0.5*(Aj-Aj)
3*(Aj+Aj) 0 0;
0 0 -Aj 3^0.5*Aj -Aj -3^0.5*Aj -4*Ai 0
(4*Ai+4*Ai+Aj+Aj) -3^0.5*(Aj-Aj) ;
0 0 3^0.5*Aj -3^0.5*Aj 3^0.5*Aj -3*Aj 0 0 -
3*0.5*(Aj-Aj) 3*(Aj+Aj) ; ]

% Calculation for b
% The value of b will be displayed
b = ((4*l)/E)*[ Pj; Pi; Pj; Pi; Pj; Pi; Pj; Pi; Pj; Pi;];
b

% The vector x is the displacements of the trusses at the joints when the load is applied
% Using LU Decomposition method to find the value of x
% Step involved in LU Decomposition

% Step 1 : Find the Upper Matrix (U) and Lower Matrix (L)

n=size (A,1);
L=zeros(n);
U=zeros(n);

for k=1:n
for j=k:n
U(k,j)=A(k,j)-L(k,1:k-1)*U(1:k-1,j);
end;
L(k,k)=1;

38
for i=k+1:n
L(i,k)=(A(i,k)-L(i,1:k-1)*U(1:k-1,k))/U(k,k);
end
end
% The L and U matrix is displayed.
L
U

% Step 2 : Use vector v to solve Lv = B by using forward substituition


v=zeros(n,1);
v(1)=b(1)/L(1,1);
for i=2:n
v(i)=(b(i)-L(i,1:i-1)*v(1:i-1))/L(i,i);
end

% Step 3 : Use x to solve Ux = v by using backward substituition


% x is the displacement of each member
x=zeros(n,1);
x(n)=v(n)/U(n,n);
for i=n-1:-1:1
x(i)=(v(i)-U(i,i+1:n)*x(i+1:n))/U(i,i);
end

% The value of x is displayed as followed


x

% The buckling is then calculated


% Step 1 : calculation of second moment of area

for i=1:11
I(i)= (pi/64)*(ODi^4-IDi^4);
end

for i=1:11
Pcr(i)=(pi^2)*E*I(i)/(l^2);

39
end

% Step 2 : calculation of load for truss

teta=90-acosd(15/30);

for i=6:11
Buckling(i)=(-Pi*cosd(teta));
end

% displayed value of buckling(i)


Buckling(i)

for i=1:5
Buckling(i)=Pj;
end

% displayed value of buckling(j)


Buckling(i)

disp(['Buckling Calculation:']);
fprintf('\n');
for i=1:11
if (Buckling(i)>Pcr(i))
disp (sprintf('The truss of &d will fail',i));
else disp (sprintf('The truss of %d will not fail',i));
end
end

40
INVERSE MATRIX
A= [2.4241 0 -1.2302 0 0 0 -0.5969
1.0339 0 0;
0 3.5814 0 0 0 0 1.0339 -
1.7907 0 0;
-1.2302 0 3.6543 0 -1.2302 0 -0.5969 -
1.0339 -0.5969 1.0339;
0 0 0 3.5814 0 0 -1.0339 -
1.7907 1.0339 -1.7907;
0 0 -1.2302 0 2.4241 0 0
0 -0.5969 1.0339;
0 0 0 0 0 3.5814 0
0 -1.0339 -1.7907;
-0.5969 1.0339 -0.5969 -1.0339 0 0 3.6543
0 -1.2302 0;
1.0339 -1.7907 -1.0339 -1.7907 0 0 0
3.5814 0 0;
0 0 -0.5969 1.0339 -0.5969 -1.0339 -1.2302
0 3.6543 0;
0 0 1.0339 -1.0339 1.0339 -1.7907 0
0 0 3.5814;];

b =[ 0;
-0.0040;
0;
-0.0040;
0;
-0.0040;
0;
-0.0040;
0;
-0.0040;];

x=inv (A)*b

41

You might also like