# Free download MATLAB file for finite element analysis of plane trusses + solved example + visualization, including temperature changes and initial strains

Articles > Free download MATLAB file for finite element analysis of plane trusses + solved example + visualization, including temperature changes and initial strains

A truss is a structure in which members are arranged in such a way that they are subjected to axial loads only. The joints in trusses are considered pinned. Plane trusses, where all members are assumed to be in x-y plane, are considered in this MATLAB code.

Please refer to Plane Trusses article to get the general idea of how this MATLAB code works and you may also find the download links there.

Example:

Consider a simple six-bar pin-jointed structure shown below. All members have the same cross-sectional area and are of the same material, E = 200 and A = 0.001; The load P = 20 and acts at an angle of 30 degrees.

each node has two degrees of freedom and thus there is a total of ten degrees of freedom.
The following values are the answers (stresses and axial forces of each member) to this problem:

This problem was solved using given MATLAB codes and the results are shown in the first picture of this article. An amplification factor was added for better visualization. Moreover, MATLAB file plots initial and deformed configurations. Displacement line (pink in figure) can be plotted now.

Temperature change and initial strains are also included. Below is a solved example:
Consider the five-bar pin-jointed structure below:

All members have the same cross-sectional area and are of the same material. The first element undergoes a temperature rise of 100 F. MATLAB code results are shown below:

Note that displacement amplification factor is 120.