Download as pdf or txt
Download as pdf or txt
You are on page 1of 26

See discussions, stats, and author profiles for this publication at: https://www.researchgate.

net/publication/360208225

Stiffness Matrix Method (Finite Elements Approach) of Beam Elements Using


MATLAB

Method · April 2022


DOI: 10.13140/RG.2.2.31708.05769/1

CITATIONS READS
0 1,859

1 author:

Ayodele Akin-Adamu
Dokuz Eylul University
3 PUBLICATIONS 0 CITATIONS

SEE PROFILE

All content following this page was uploaded by Ayodele Akin-Adamu on 25 May 2022.

The user has requested enhancement of the downloaded file.


Stiffness matrix method (finite element approach) of beam elements using MATLAB

Ayodele Akin-Adamu1

Abstract

In this paper a structural beam (3 span continuous beam type) that can resist transverse loading only by
transferring only bending moment and shear force at its start and end nodes is investigated.
Unfuntuanately, the effect of axial loading along the span of the beam is not considered in this paper.
The stiffness matrix method by using the Castigliano approach is used for the derivation of the local
stiffness matrix of beam elements. 1st principle derivation is presented by using the Castigliano’s
approach. The methodology of using the stiffness matrix approach which is very similar to the finite
element approach is explained by using an analysis example. MATLAB software is used in the
computation approach because of the easy of assembly of the global stiffness matrix of the beam
structure and carrying out other matrix manipulation as required. Different types of transverse loading
and support displacement conditions are considered in the analysis example presented in the paper.
These included transverse loading like partial uniformly distributed loading on a beam, point loading
for forces and moments both along the span and at support locations, the vertical settlement of support
and the application of rotation at support node is also considered. Staad.Pro software which is a reliable
structural software is finally used to validate the results of the analysis example in this paper.

Keywords: Beam analysis, Indeterminate beams, Castigliano approach, Stiffness Matrix method,
MATLAB, Staad.Pro.

Introduction
Beam members are found in almost all civil engineering infrastructures today. They are mostly used in
supporting horizontal plate members such as concrete slabs, steel plates etc. They are connected to
columns and these columns helps transmit the structural loads safely to the foundation. The beam
connections to the columns affect the type of support that can be attributed at beam supports. Generally,
at intermediate support of beams, these supports are assumed to be represented by roller supports. In
reinforced building structures made of structural frame, the end support can be reasonably assumed as
fixed support because of its monolithic construction connection. For steel structural frames, the end
support is assumed as either pinned or fixed depending on the stiffness of the steel connection which is
dependent on the thickness of plate and number of bolts at the steel connection.
Beam used in Civil Engineering infrastructural projects can be made with several type of material such
as steel, timber, conventional concrete, ultrahigh performance concrete etc. Two important mechanical
and sectional properties that are needed for beam analysis are the elastic young modulus and the moment
of inertia respectively. The use of MATLAB for beam analysis using the stiffness matrix methodology
greatly simplify the analysis of any statically indeterminate beams.
In this paper, the stiffness matrix method for beam element formula will be proved. The basic steps of
programming the stiffness method will be listed and the corresponding MATLAB code will be written
to compute the global stiffness matrix, deflection and internal axial forces of a beam structural system.

Stiffness matrix methodology for beam element.


The local stiffness matrix of beam element can be derived through several methods. Example of these
methods include;
1. Double integration method
2. Castigliano’s method

1
Dokuz Eylül Üniversitesi, Fen Bilimleri Enstitüsü, Bornova, 35100, İzmir
3. Virtual work method
4. Potential energy method
5. Galerkin method
In this paper, the Castigliano’s method is used in the derivation of the local stiffness matrix of a beam
element.

Figure 1: shows external actions (𝑀 & 𝑀 ) causing rotation deformations Ø 𝑎𝑛𝑑 Ø at beam node.
Consider a straight beam element i in fig 1b that is subjected to external actions (moments Mj and Mk)
at node j and k respectively. The beam member deformed into the continuous blue line as shown in fig
1a. The rotation angles at node j and k due to the applied moments are Øj and Øj respectively.
According to Castigliano’s theory for beam deformation, the partial derivative of the strain energy with
respect to an applied force (or moment) is equal to the deformation (displacement or rotation) of the
force (or couple) along its line of action.

General strain energy formula for a beam subjected to different type of actions is shown below:

𝑁 𝑇 𝑇 𝑀 𝑀 𝑀
U = + + + + + 𝑑𝑥
𝐴𝐸 𝐴𝐺 𝐴 𝐺 𝐸𝐼 𝐸𝐼 𝐺𝐼

For this case considering only 2 degrees of freedom at each node,


𝑀
U = 𝑑𝑥
2𝐸𝐼
𝑀 + 𝑀
𝑀= ∗𝑥− 𝑀
𝐿
𝑀 + 𝑀
𝐿 ∗𝑥− 𝑀
U = 𝑑𝑥
2𝐸𝐼

1 𝑀 + 𝑀
U = ∗𝑥− 𝑀 𝑑𝑥
2𝐸𝐼 𝐿

1
U = 𝑀𝑥+ 𝑀 𝑥− 𝑀𝑙 𝑑𝑥
2𝐸𝐼 𝐿𝑖
1 𝑀 𝑙 𝑀 𝑙 𝑀𝑀 𝑙
U = + −
2𝐸𝐼 3 3 3
U is the strain energy stored in the body in terms of external actions 𝑀 and 𝑀 respectively and this
strain energy equation is shown above.
∂U 1 𝑀𝑙 𝑀 𝑙
∅ = = −
∂𝑀 𝐸𝐼 3 6
∂U 1 𝑀𝑙 𝑀 𝑙
∅ = = − +
∂𝑀 𝐸𝐼 6 3

∅ and ∅ are rotation angles at node j and k due to the applied external action. These are shown by the
2 equations above
𝑙 𝑙
⎡ − ⎤
⎢ 3𝐸𝐼 6𝐸𝐼 ⎥ 𝑀 =

⎢ 𝑙 𝑙 ⎥ 𝑀 ∅
⎢− ⎥
⎣ 6𝐸𝐼 3𝐸𝐼 ⎦
𝑙 𝑙
⎡ − ⎤
3𝐸𝐼 6𝐸𝐼 𝑀 ∅
𝐹 = ⎢⎢ ⎥; 𝑃
⎥ = ; ∅ =
𝑙 𝑙 𝑀 ∅
⎢− ⎥
⎣ 6𝐸𝐼 3𝐸𝐼 ⎦
𝐹 𝑃 = ∅
Matrix form of external actions and rotation angles at the beam nodes shown above.
𝐹
𝑘 =
𝐹

Basic rigidity matrix can be written in terms of the flexibility matrix 𝐹 , shown above.

𝑙 𝑙 𝑙
𝐹 = − =
9(𝐸𝐼 ) 36(𝐸𝐼 ) 12(𝐸𝐼 )
𝑙 12(𝐸𝐼 ) 𝑙 12(𝐸𝐼 )
⎡ × − × ⎤
⎢ 3𝐸𝐼 𝑙 6𝐸𝐼 𝑙 ⎥
𝑘 = ⎢ ⎥
𝑙 12(𝐸𝐼 ) 𝑙 12(𝐸𝐼 )
⎢− × × ⎥
⎣ 6𝐸𝐼 𝑙 3𝐸𝐼 𝑙 ⎦

4𝐸𝐼 2𝐸𝐼
⎡ − ⎤
𝑙 𝑙
𝑘 = ⎢ ⎥
⎢− 2𝐸𝐼 4𝐸𝐼 ⎥
⎣ 𝑙 𝑙 ⎦
Relationship between global internal end forces (bending and shear force) and displacements

Figure 2: Relationship between internal forces and deformation at start and end node of beam
element.
P
⎡ ⎤
𝑀
The global end forces of each beam element can be expressed as a force vector [𝑃] = ⎢ ⎥ as shown
⎢P ⎥
⎣𝑀 ⎦
in fig 2b.
M + M −(M + M )
P = ; P = ;𝑀 = 𝑀 ;𝑀 = 𝑀
𝑙 𝑙
Using Fig 2b. [𝑃] matrix elements are defined as shown by the 4 equations above.
1 1
⎡ ⎤ P
⎢ 𝑙 𝑙 ⎥ ⎡ ⎤
⎢ 1 0 ⎥ 𝑀 = ⎢
𝑀

⎢− 1 1 𝑀
− ⎥ ⎢P ⎥
⎢ 𝑙 𝑙⎥ ⎣𝑀 ⎦
⎣ 0 0 ⎦
[𝐿 ] 𝑃 = 𝑃

Matrix form connecting external applied actions with internal actions.


1 1
⎡ ⎤
⎢ 𝑙 𝑙 ⎥
[𝐿 ] = ⎢ 1 0 ⎥
⎢− 1 1
− ⎥
⎢ 𝑙 𝑙⎥
⎣ 0 0 ⎦
δ − δ δ − δ
Ø = ; Ø =
𝑙 𝑙
Using Fig 2a. the rotation angles and vertical displacement at node points are connected as expressed
by the 2 equation above.
1 1 𝛿
⎡ 1 − 0⎤ ⎡ ⎤
𝑙 𝑙 ⎢Ø ⎥ = Ø
⎢ ⎥
⎢𝛿 ⎥
⎢1 0 −
1
1⎥ ⎢ ⎥ Ø
⎣𝑙 𝑙 ⎦ ⎣Ø ⎦
[𝐿 ] [𝛿 ] = Ø
1 1
⎡ 1 − 0⎤
𝑙 𝑙
[𝐿 ] = ⎢ ⎥
⎢1 0 −
1
1⎥
⎣𝑙 𝑙 ⎦
[𝐿 ] 𝑃 = 𝑃
[𝐿 ] is the beam transformation matrix. It transforms the beam local effects to the global effects.

𝑃 is the global force matrix for beam i.

[𝐿 ] 𝑘 Ø = 𝑃

[𝐿 ] 𝑘 [𝐿 ] [𝛿 ] = 𝑃

𝑘 = [𝐿 ] 𝑘 [𝐿 ]

⎡ − ⎤
⎢ ⎥
⎢ − ⎥
𝑘 =⎢ ⎥
⎢− − − ⎥
⎢ ⎥
⎣ − ⎦ ×

By carrying out the matrix multiplication shown above, the global stiffness matrix is obtained.
𝑃 = 𝑘 [𝛿 ] + 𝑃

[𝛿 ] = 𝑘 𝑃 − 𝑃

The global deformations at each node (rotations and vertical displacement) are obtained by the
expression above ([𝛿 ]). 𝑃 is the nodal force vector. It is used to input nodal point loading and nodal
moment loading in the equation.
𝑘 [𝛿 ] = 𝑃

𝑃 = 𝑘 [𝛿 ] + 𝑃

The expression above can be used to determine the external actions of each beam element at its nodes.
𝑃 is defined as the external actions when considering the external transverse forces along the span
of the beam and also considering the beam element having fixed support at its ends.
Figure 3: Numerical Example question.
In this paper the 3-span continuous beam structure will be solved using the method described above
using the MATLAB software and the results will be compared with Staad.pro software result for
validation purpose.
The general procedure for structural analysis of beam structure includes the following:
1. Decide on the number of elements in the model. It is important to divide the structure into
element at each salient point. Salient points are defined as points such as start and end nodes,
beginning and end of a uniformly distributed loads, positions of point or moment loading etc.
If the beam element is not defined in this manner, some numerical calculation problem usually
arises after you have computed the global deformation vector matrix. The 3-span beam in fig 3
is divided into 6 elements considering the salient points along the beam structure (fig. 4b)
instead of 3 elements (fig. 4a) as shown in fig. 4 below. Using MATLAB for computation, there
is no need to be worried about the number of elements.

Figure 4: Division of beam structure into finite elements.


2. The next step in the analysis process involving numbering the nodes and the degree of freedom
at each node. Also, an arrowhead is placed on each beam element in order to indicate the start
and end node for each element. The numbering process is described in fig. 5 shown below.
Figure 5. Numbering of beam elements and numbering of degree of freedom
3. Determine the local stiffness matrix of each element that were divided using the matrix form
shown below. On MATLAB, the stiffness matrixes for all element can be easily generated by
creating a function that takes the length, young modulus and moment of inertia values as input
variables.

⎡ − ⎤
⎢ ⎥
⎢ − ⎥
𝑘 =⎢ ⎥
⎢− − − ⎥
⎢ ⎥
⎣ − ⎦ ×

These local stiffness matrixes of each element are numbered from the numbering of the
degree of freedom at its start and end nodes. For example, element 1 is numbered 1, 2, 3 and
4.
1 2 3 4

− 1
⎡ ⎤
⎢ ⎥
⎢ − ⎥ 2
[𝑘 ] = ⎢ ⎥
⎢− − − ⎥ 3
⎢ ⎥
⎣ − ⎦4 ×

4. The global stiffness matrix is assembled on MATLAB by combining all the local stiffness
matrixes into a single matrix of matrix size equal to the maximum number of degrees of
freedom. For the numerical example solved in this paper, the global matrix stiffness size is 14
x 14. A zero matrix of size 14 x 14 is created for our numerical example, then each local
stiffness matrix is added to this base matrix. For example, given that the zero matrix is defined
as K on MATLAB, the local stiffness matrix of k1 is added as shown below.
𝐾(1: 4, 1: 4) = 𝐾(1: 4, 1: 4) + 𝑘1
5. The global stiffness matrix has been generated from step 4, now we apply boundary conditions
to the beam structure by adding the value of (inf) to the diagonal elements of the global stiffness
matrix where the support is located using MATLAB. This is evaluated in MATLAB using the
MATLAB coding shown below.
𝐾(1, 1) = 𝐾(1,1) + 𝑖𝑛𝑓

Inf value is added to denote the supports of the beam. However, at support location where there
is vertical settlement of support or a rotational angle imposed, this support is not denoted by
adding inf value to the diagonal element of the global stiffness matrix. A large value which we
can be denoted as C is added to the global stiffness matrix. C can be expressed as the maximum
element value in the global stiffness matrix multiplied by 10000. The MATLAB coding for this
procedure is shown below using our numerical example. Because there is an imposed
deformation at support 3 and 6, element values of the global stiffness matrix at (5,5) and (14,14)
are modified with the value of C.
𝐶 = max 𝐾(: ) × 10000
𝐾(5, 5) = 𝐾(5,5) + 𝐶
𝐾(14, 14) = 𝐾(14,14) + 𝐶
6. A zero global force vector matrix, Pgb is defined for forces applied directly at the start or end
of each element. On MATLAB, Pgb is defined as shown in the MATLAB coding below; Then
the nodal forces are added to the base zero matrix created. For example, in our numerical
example, at node 5 of the beam structure, a positive clockwise moment is applied which is equal
to 15,000Nm. A negative anticlockwise moment value of -15,000N/m is added to the 10th
element of the force vector matrix because of the external load applied.
𝑃 = 𝑧𝑒𝑟𝑜𝑠(14,1)

𝑃 (10) = 𝑃 (10) − 15,000

7. Another zero global force matrix, PgbA is defined for forces applied along the span of each
element. On MATLAB, PgbA is defined as shown in the MATLAB coding below; Then the
equivalent nodal forces due to the span loadings are added to the base zero matrix created. For
example, in our numerical example, the uniform distributed loading on 2nd element is added
as shown.
𝑃 𝐴 = 𝑧𝑒𝑟𝑜𝑠(14,1)

𝑃 𝐴(3: 6) = 𝑃 𝐴(3: 6) + [5000 ∗ 5 / 2, 5000 ∗ 25/12, 5000 ∗ 5/2,


−5000 ∗ 25/12]′
8. Global force matrix, PgbA from step 7 above is modified for vertical displacement and
rotational boundary condition at degree of freedom 5 and 14 respectively. The product of C and
the value of deformation at the node is added to the force vector matrix. The MATLAB coding
using the numerical example is shown below for the modification.
𝑃 𝐴(5) = 𝑃 𝐴(5) + 𝐶 ∗ 0.0025

𝑃 𝐴(14) = 𝑃 𝐴(14) + 𝐶 ∗ 1.7453e − 05

9. After Pgb and PgbA have been evaluated on MATLAB, the displacement vector matrix is
evaluated using the equation shown below and the MATLAB code.

[𝛿 ] = 𝑘 𝑃 − 𝑃

𝑄 = 𝑖𝑛𝑣(𝐾) ∗ 𝑃 − 𝑃 𝐴

10. The displacement values (vector matrixes) can be extracted from the global displacement
matrix 𝑄 in step 8. For example, in the numerical example, the displacement vector matrix of
element 1, 𝑄 is extracted using the MATLAB code shown below.
𝑄 = 𝑄 (1: 4)

11. Finally, the end reactions of each element are computed using the equation shown below and
the MATLAB coding respectively.
[𝑅 ] = 𝑘 [𝛿 ] + 𝑃

𝑅 =𝑘 ∗ 𝑄 + 𝑃 𝐴

Note: 𝑃 𝐴 for element 1 needs to be extracted from 𝑃 𝐴 using the MATLAB code below.

𝑃 𝐴 = 𝑃 𝐴 (1: 4)

MATLAB coding for the numerical example using live script

Analysis of statically indeterminate 3-span beam by stiffness method (finite element)

Figure 6: 3-Span continuous beam

% L1 to L6 represent the length of each element in meters

% function T1 = BEAMS(L, EI)

T1 = EI * [12/L^3, 6/L^2, -12/L^3, 6/L^2; 6/L^2, 4/L, -6/L^2, 2/L; -12/L^3, -6/L^2, 12/L^3, -6/L^2;
6/L^2, 2/L, -6/L^2, 4/L];

% EI represents the flexural rigidity of each element in Nm2

K = BEAMS(L, EI) is my defined element stiffness matrix function

L = length of the element in meters

E = Young modulus in N/m2

I = moment of inertia in m4

STEP 1: Decide on the number of elements in the model.

STEP 2: Numbering of nodes and the degree of freedom at each node.


STEP 3: Determine the local stiffness matrix of each element.
STEP 4 Assembly of global stiffness matrix.
STEP 5: Modification of global stiffness matrix for boundary conditions.
𝐾

Inf 0.0000 −0.0000 0.0000 0 0 0 0 0 0 0 0 0 0

⎢ ⎥
⎢ ⎥
⎢ 0.0000 Inf −0.0000 0.0000 0 0 0 0 0 0 0 0 0 0 ⎥
⎢ ⎥
⎢ ⎥
⎢−0.0000 −0.0000 0.0000 −0.0000 −0.0000 0.0000 0 0 0 0 0 0 0 0 ⎥
⎢ ⎥
⎢ ⎥
⎢ 0.0000 0.0000 −0.0000 0.0001 −0.0000 0.0000 0 0 0 0 0 0 0 0 ⎥
⎢ ⎥
⎢ ⎥
⎢ 0 0 −0.0000 −0.0000 1.1617 0 −0.0000 0.0000 0 0 0 0 0 0 ⎥
⎢ ⎥
⎢ ⎥
⎢ ⎥

0 0 0.0000 0.0000 0 0.0001 −0.0000 0.0000 0 0 0 0 0 0

⎢ ⎥
⎢ ⎥
⎢ 0 0 0 0 −0.0000 −0.0000 0.0000 0.0000 −0.0000 0.0000 0 0 0 0 ⎥
= ⎢ ⎥ 10
⎢ ⎥
⎢ 0 0 0 0 0.0000 0.0000 0.0000 0.0001 −0.0000 0.0000 0 0 0 0 ⎥
⎢ ⎥
⎢ ⎥
⎢ 0 0 0 0 0 0 −0.0000 −0.0000 Inf 0.0000 −0.0001 0.0001 0 0 ⎥
⎢ ⎥
⎢ ⎥
⎢ 0 0 0 0 0 0 0.0000 0.0000 0.0000 0.0001 −0.0001 0.0000 0 0 ⎥
⎢ ⎥
⎢ ⎥
⎢ ⎥
⎢ 0 0 0 0 0 0 0 0 −0.0001 −0.0001 0.0001 −0.0000 −0.0000 0.0000 ⎥
⎢ ⎥
⎢ ⎥
⎢ 0 0 0 0 0 0 0 0 0.0001 0.0000 −0.0000 0.0001 −0.0000 0.0000 ⎥
⎢ ⎥
⎢ ⎥
⎢ 0 0 0 0 0 0 0 0 0 0 −0.0000 −0.0000 Inf −0.0000⎥
⎢ ⎥
⎢ ⎥
⎣ 0 0 0 0 0 0 0 0 0 0 0.0000 0.0000 −0.0000 1.1617 ⎦
STEP 6: Assembly of force vector for nodal loads, Pgb.
STEP 7: Assembly of force vector for span loads, PgbA.
STEP 8: Modification of force vector for span loads, PgbA.
STEP 9: The displacement vector matrix, Qb is evaluated.
STEP 10: Extraction of the displacement vector matrix from step 9.
STEP 11: Computation of the end forces at node of each element.
Verification of results using staad.pro software

Figure 7: Staad.pro Beam model with reaction result displayed.


In order to verify the accuracy and precision of the use MATLAB in these analyses, The results
of deformation and reactions forces of each beam element of staad.pro is compared with
MATLAB results. It was found that the MATLAB results is very close with staad.pro software
results. For example, as seen in the table below staad.pro result predict a reaction value of
90.490kNm at the fixed end support of element. MATLAB result predicted 96.08kNm as seen
from the R1 vector matrix in page 19.

Figure 8: Staad.pro reaction results

Figure 9: Staad.pro deflected shape diagram


Figure 10: Staad.pro displacement prediction for beam element at node their points

Figure 11: Staad.pro bending moment diagram

Figure 12: Staad.pro shear force diagram


View publication stats

Figure 13: Staad.pro bending moment and shear force value prediction along the span of the beam
elements.

References
[1] Çatal, HH., (2014). Yapı ve Deprem Mühendisliğinde Matris Yöntemler. Publication of Dokuz
Eylul Universisty, Faculty

You might also like