2D Truss elements finite element MATLAB code

This MATLAB code is for two-dimensional truss elements (plane truss structures). This code plots the initial configuration and deformed configuration of the structure as well as the forces on each element. Results are verified with examples of textbook; arbitrary input geometry, nodal loads, and material properties for each element can be defined by user.

Below is a higher resolution figure of the results including the initial configuration, deformed configuration, displacement vectors, and internal forces of each element (C stands for Compressive; T for Tensile). You can also choose an "amplification factor" which lets you magnify the real displacement values (on the graph only) for the sake of better visualization.
You can compare the results with the forces given in the textbook which is replicated below:
This code is also capable of solving plane truss problems with initial strains and/or temperature loading such as the one given below:
And the results:

How can I get this code (matlab files or functions)?

You may have these codes for your research purposes. Email me at hosseinali.sut@gmail.com using your official/academic email address.

What other codes are available at matlab-fem.com?

1D Spring elements finite element MATLAB code
1D Beam elements finite element MATLAB code
2D Truss elements finite element MATLAB code
2D Beam elements finite element MATLAB code
2D Solid elements finite element MATLAB code
2D Penalty and Lagrange Multiplier Contact finite element MATLAB code
2D Large deformations finite element MATLAB code
2D XFEM for Crack eXtended finite element MATLAB code
3D Truss elements finite element MATLAB code
3D Solid elements finite element MATLAB code
3D Large deformations finite element MATLAB code

What is Finite Element Method?

The finite element method (FEM) is a numerical method for solving problems of engineering and mathematical physics. It is also referred to as finite element analysis (FEA). Typical problem areas of interest include structural analysis, heat transfer, fluid flow, mass transport, and electromagnetic potential. The analytical solution of these problems generally require the solution to boundary value problems for partial differential equations. Read more about Finite Element Methods

What is MATLAB?

MATLAB (matrix laboratory) is a multi-paradigm numerical computing environment. A proprietary programming language developed by MathWorks, MATLAB allows matrix manipulations, plotting of functions and data, implementation of algorithms, creation of user interfaces, and interfacing with programs written in other languages, including C, C++, C#, Java, Fortran and Python.

What reference books did I use for my codes?

Some of the main textbooks I used for codes are:
General concepts and basic codes:
  1. Finite Element Procedures by K.J. Bathe
  2. The Finite Element Method (v.1 & v.2 & v.3) by Zienkiewicz & Taylor
  3. Fundamental finite element analysis and applications by M. Asghar Bhatti
Contact mechanics:
  1. Computational Contact Mechanics by Peter Wriggers
Plasticity:
  1. Finite Elements in Plasticity by D. R. J. Owen, E. Hinton
  2. Non-Linear Finite Element Analysis of Solids and Structures (vol. 1 & 2) by M. A. Crisfield