File Exchange

## Truss Analysis

version 1.0 (92.9 KB) by

A very simple M-file for analysis of any truss

4.36842
19 Ratings

114 Downloads

Updated

No License

A very simple M-file for analysis of any truss (2-D & 3-D), calculating of forces, deflections , reactions and drawing the truss and deformation shape

John Snow

Thank you.

Daniel

### Daniel (view profile)

Does it matter if I input the loads and distances in metric? The example is in imperial

Bryce Nathaniel Burns

Danial Talebi

### Danial Talebi (view profile)

Thank you Dr.Rahami
He is the best teacher.

I had this chance in my life to being his student.

I learned from you and I wrote my code in structural analysis

op op

Good

Zeeshan Chughtai

Johnny Domina

### Johnny Domina (view profile)

I cannot get this program to run with a simple truss I am trying to use and I cannot figure out what is wrong with the data.

Coord=[0 16.25 0;16 16.25 0;24 16.25 0;0 0 0;8 0 0;24 0 0]; % coordinates of nodes
Con=[1 2;2 3;2 5;4 5;5 6;3 6];
Re=[1 1 1;0 0 1;0 0 1;1 1 1;0 0 1;0 0 1];
Load=zeros(size(Coord)); Load(6,:)=[0 -10 0];
%Load=[0 0 0;0 -1e5 0;0 0 0;0 -1e5 0;0 0 0;0 0 0];
E=ones(1,size(Con,1))*102000; %*1e7; % Elasticity ( Youngs Modulous)
%E=[1 1 1 1 1 1 1 1 1 1]*1e7;
A=[.25 .25 .25 .25 .25 .25];
D=struct('Coord',Coord','Con',Con','Re',Re','Load',Load','E',E','A',A');

The output:
F =

0 0 0 0 0 12.2596

U =

1.0e+13 *

0 0 0 0 0 0
0 0 -5.7399 0 0 -5.7399
0 0 0 0 0 0

R =

0 0 0 0 0 0
0 0 0 0 0 0
0 0 0 0 0 0

Chris Jobes

### Chris Jobes (view profile)

Very concise code, a bit hard to understand for a novice without a lot of work, but pretty straight forward for those of us in the field. I decided to compare it to a MATLAB script that I wrote based upon Moaveni's book many years ago. It was not nearly as concise, but much more understandable.

I do have an issue with the ST.m code, however. There appears to be an error that only appears if a load is applied to a node that has constrained movement in that direction.

A quick check of the applied loads and reaction force sums should yield 0 in the x and y directions. In one of my test scripts, it did not. The test was a roof truss with snow load concentrations applied at the upper nodes. Two of those nodes had vertical constraints where the truss rested on the wall top plates and the reaction forces I calculated using this script were incorrect.

The fix is easily made and only appears in an odd case. Line 9 should be:

R=reshape(S*U(:),w)-D.Load;R(f)=0;

since R=KU-F. I have not yet tested your MSA code, but at a glance, it appears to have the same issue.

Otherwise, great job.

tong mu

Frank McHugh

### Frank McHugh (view profile)

For the convience of those who found this code to obtuse, I've uploaded a copy with the ST function reformatted and extensive comments added at
http://www.mathworks.com/matlabcentral/fileexchange/38044
No actual code changes but should be easier to understand, and have confidence in this code

Jeffrey Kantor

### Jeffrey Kantor (view profile)

Amazingly brief, but hard to decipher. Sorry to be a killjoy, but this would be better if the functions included even minimal comments and documentation, and was written for clarity rather than brevity.

mohan l

Guillermo Rein

### Guillermo Rein (view profile)

Thanks for sharing this excellent script. I have used it for two years now in my Mechanical Design course (~60 students each). The students find difficulties in the Help.doc document but otherwise the code is robust, simple and fast to solve trusses.

helen joli

Charlie Seviour

Thanks

Emilio Elli

ali yaseri

thanks

mohamad ordelalu

tanks alot

navid amiry

thanks for this file

Ali Özgül

Documentation:
+Publis M-files application and theory (1)
+Graphical program interface (5)
+Workable program description (2)
+Works references (3)

Programming:
+M-files complexity (4)
+Mlint error message (5)
+Help problems (2)
+Filename of clashes (5)
+Clone the code line (5)
+Program's symbolic manuscript (3)
+Program samples and runing test (3)
+System requirements (5)
+Program running speed (5)

Files archive:
Seleceted file name (3)
Per files comment (3)
All files usefuly (4)

Thanks:
Nice works, I think needs improvements.
Good works.

Menza T

Nicely written.

anjo mirend

great works :) thanks

edurzimo porteynizm

that's very brief! excelent

### Updates

 12 Apr 2007 Reactions 27 Mar 2007 Adding an image 26 Mar 2007 Draw Truss and Deformation Shape 26 Mar 2007 Plot The Truss 26 Mar 2007 Changing Category 21 Mar 2007 Updating 20 Mar 2007 A New Help
MATLAB 7 (R14)
##### Acknowledgements

Download apps, toolboxes, and other File Exchange content using Add-On Explorer in MATLAB.