Truss Analysis Calculator
Analyze 2D pin-jointed trusses by the direct stiffness method. Calculate member forces, stresses, support reactions and joint displacements with force-coloured diagrams.
This truss analysis calculator finds axial member forces, support reactions and joint displacements in a two-dimensional, pin-jointed structure. Engineers can use it for preliminary load-path studies, while students can compare equilibrium calculations with the direct stiffness method taught in structural mechanics. The force-coloured drawing makes tension and compression easy to identify.
Start with the five-joint Warren truss or the three-joint triangle. Enter the span, height, Young's modulus and cross-sectional area, then apply horizontal and vertical forces at the numbered joints. The preset layouts have a pin at joint 1 and a horizontal sliding roller at joint 3. Positive x acts to the right, positive y acts upward, and a downward load therefore has a negative y component. The load multiplier scales the whole load case together.
For another arrangement, choose Custom. Up to six joints and twelve members can be entered. Use consecutive joint numbers starting at 1. Give each active joint its x and y coordinates and select the directions restrained by its support. Select each member's pair of end joints, or choose Off. Joints beyond the highest connected number are unused; leave their applied forces at zero. Bars that cross on the drawing do not share a connection unless their connectivity names the same joint. For unequal sections, set each custom member's area multiplier relative to the base area; all members share the entered elastic modulus. The metric/US switch converts physical inputs and tabulated results.
Read the member table for signed axial forces and normal stresses: positive means tension and negative means compression. Peak compression is reported as a positive magnitude in its result card. Separate joint tables list displacement components and support reactions. Reactions act on the truss and include any force applied directly at a restrained joint. A second drawing magnifies displacements automatically and states the scale factor; it shows the direction of deformation rather than the true visible size.
The truss calculator assembles each bar's transformed axial stiffness into a global matrix, imposes zero support displacements and solves the remaining equilibrium equations. It handles stable, statically determinate and redundant arrangements. Invalid connections, zero-length members and mechanisms produce a message explaining what to correct.
Use these results within the assumptions of linear elasticity and small displacements. The model excludes bending, joint rigidity, self-weight unless entered as joint forces, thermal strain, settlement and out-of-plane effects. Compression results do not establish buckling resistance. Check member strength, stability, connections, loading rules and serviceability separately before using a truss in a real structure.
How it is calculated
The direct stiffness method uses two translations per joint. For a bar between joints i and j, calculate its length L and direction cosines c=Δx/L and s=Δy/L. With b=[−c,−s,c,s], the element matrix is kₑ=(EA/L)bᵀb. Add its entries to the global matrix K using the connected translation numbers. Impose zero translations at restrained directions and solve Kff uf=Pf; the original K then gives reactions R=Ku−P. Recover axial force N=(EA/L)b uₑ and normal stress σ=N/A. Positive member force and stress mean tension; negative mean compression.
Coordinates and forces are explicitly converted to mm, N and MPa for assembly. All members share E; custom area is the base area times its dimensionless member multiplier. A diagonally scaled Cholesky pivot test rejects mechanisms before the linear solve. This implementation is derived from axial compatibility, Hooke's law and equilibrium, following the stiffness formulation described by Jönköping University's Truss analysis chapter, and checked against CALFEM's independent FEM examples.
Reference correction: the attached Ottosson report, Appendix D, PDF pages 49–51, contains a nine-row malformed topology for a ten-bar truss and an invalid code output of −1.81618691e+12. Its prose gives finite millimetre-scale displacements. The second reference case uses the corrected connectivity and numerical results in the current official CALFEM manual (exs_bar2_l); it does not fit the solver to the broken listing.
Assumptions
- Straight, prismatic, pin-jointed bars carry axial force only. Connections share translations but transmit no moment.
- Linear elastic material, common Young's modulus, small strains and small displacements. Each bar resists both tension and compression.
- Loads act only at joints. Self-weight is excluded unless represented by joint loads.
- Supports restrain the chosen global x and/or y translations with zero settlement. Roller axes are aligned with the global axes.
- A crossing is a connection only when members explicitly share the same numbered joint. Duplicate joint pairs are combined into one member with the required total area.
- The force diagram shows the undeformed geometry. The deformation diagram uses an automatic magnification, shown in its caption. This scale never changes the analysis.
Where it applies
Supports 2D layouts with up to 6 consecutively numbered joints and 12 members, including stable statically determinate and redundant trusses. Custom joints beyond the highest connected joint number are ignored and must have zero entered loads. Joints inside the active number range must be connected or fully restrained. The presets use a pin at J1 and a y restraint at J3.
Distinct joint positions and member lengths must exceed 1e-8 of the model extent (with a 1 mm extent floor). A normalized stiffness pivot at or below 1e-10 is rejected as unstable or numerically ill-conditioned. This numerical check does not assess structural buckling. Reactions in free directions are exactly zero; restrained components below 1e-10 of the largest load component (with a 1 N floor) are displayed as numerical zero. The raw free-direction residual remains available in the calculation steps.
The displacement warning at 1% of the shortest member is a screening threshold, not a design limit. The tool does not check yielding, member or overall buckling, connection strength, deflection limits, out-of-plane bracing, bending, dynamics, thermal effects, fabrication errors, support movement, cables or tension-only behaviour. Check those effects and the applicable design rules separately.
References
- Jönköping University, Applied Mechanics, Truss analysis: compatibility, axial stiffness and K=AᵀKᵉA. https://mechanics.ju.se/SolidMechanics/TrussAnalysis.html
- CALFEM for Python, official manual, exs_bar2 and exs_bar2_l: independent plane-truss FEM displacements, reactions and signed member forces. https://calfem-python-manual.readthedocs.io/en/latest/examples.html
- A. Ottosson (2010), Implementation of CALFEM for Python, Appendices C–D, PDF pp. 44–51. Appendix D's old code listing is erroneous; see the correction above. https://raw.githubusercontent.com/CALFEM/calfem-python/master/reports/manual.pdf
Inputs
| Input | Symbol | Unit | Default |
|---|---|---|---|
| Truss layout Preset supports: J1 pinned and J3 restrained vertically. Custom uses numbered joint pairs; choose Off to omit a member. Use consecutive active joint numbers starting at 1. Crossing bars connect only at an explicitly shared joint. | model | Warren truss — 5 joints, 7 members | |
| Span | L_span | m | 6 |
| Height | H_truss | m | 2 |
| Young's modulus (all members) | E_mod | GPa | 200 |
| Base cross-sectional area Presets use this area for every member. Custom members use this area multiplied by their individual area multiplier. | A_common | mm^2 | 1000 |
| Load multiplier Multiplies every entered joint force. Zero gives the unloaded state; negative values reverse all loads. | load_factor | 1 | |
| x coordinate | x_1 | m | 0 |
| y coordinate | y_1 | m | 0 |
| Support restraint Support movements are zero. x points right and y points up. | support_1 | Pinned — x and y fixed | |
| Applied force x (+ right) | Fx_1 | kN | 0 |
| Applied force y (+ up) | Fy_1 | kN | 0 |
| x coordinate | x_2 | m | 3 |
| y coordinate | y_2 | m | 0 |
| Support restraint Support movements are zero. x points right and y points up. | support_2 | Free joint | |
| Applied force x (+ right) | Fx_2 | kN | 0 |
| Applied force y (+ up) | Fy_2 | kN | -20 |
| x coordinate | x_3 | m | 6 |
| y coordinate | y_3 | m | 0 |
| Support restraint Support movements are zero. x points right and y points up. | support_3 | Roller — y fixed, x free | |
| Applied force x (+ right) | Fx_3 | kN | 0 |
| Applied force y (+ up) | Fy_3 | kN | 0 |
| x coordinate | x_4 | m | 1.5 |
| y coordinate | y_4 | m | 2 |
| Support restraint Support movements are zero. x points right and y points up. | support_4 | Free joint | |
| Applied force x (+ right) | Fx_4 | kN | 0 |
| Applied force y (+ up) | Fy_4 | kN | 0 |
| x coordinate | x_5 | m | 4.5 |
| y coordinate | y_5 | m | 2 |
| Support restraint Support movements are zero. x points right and y points up. | support_5 | Free joint | |
| Applied force x (+ right) | Fx_5 | kN | 0 |
| Applied force y (+ up) | Fy_5 | kN | 0 |
| x coordinate | x_6 | m | 3 |
| y coordinate | y_6 | m | 4 |
| Support restraint Support movements are zero. x points right and y points up. | support_6 | Free joint | |
| Applied force x (+ right) | Fx_6 | kN | 0 |
| Applied force y (+ up) | Fy_6 | kN | 0 |
| End joints | pair_1 | J1 — J2 | |
| Area multiplier (× base area) For a 600 mm² member with a 1000 mm² base area, enter 0.6. | area_1 | 1 | |
| End joints | pair_2 | J2 — J3 | |
| Area multiplier (× base area) For a 600 mm² member with a 1000 mm² base area, enter 0.6. | area_2 | 1 | |
| End joints | pair_3 | J1 — J4 | |
| Area multiplier (× base area) For a 600 mm² member with a 1000 mm² base area, enter 0.6. | area_3 | 1 | |
| End joints | pair_4 | J2 — J4 | |
| Area multiplier (× base area) For a 600 mm² member with a 1000 mm² base area, enter 0.6. | area_4 | 1 | |
| End joints | pair_5 | J2 — J5 | |
| Area multiplier (× base area) For a 600 mm² member with a 1000 mm² base area, enter 0.6. | area_5 | 1 | |
| End joints | pair_6 | J3 — J5 | |
| Area multiplier (× base area) For a 600 mm² member with a 1000 mm² base area, enter 0.6. | area_6 | 1 | |
| End joints | pair_7 | J4 — J5 | |
| Area multiplier (× base area) For a 600 mm² member with a 1000 mm² base area, enter 0.6. | area_7 | 1 | |
| End joints | pair_8 | Off — member not present | |
| Area multiplier (× base area) For a 600 mm² member with a 1000 mm² base area, enter 0.6. | area_8 | 1 | |
| End joints | pair_9 | Off — member not present | |
| Area multiplier (× base area) For a 600 mm² member with a 1000 mm² base area, enter 0.6. | area_9 | 1 | |
| End joints | pair_10 | Off — member not present | |
| Area multiplier (× base area) For a 600 mm² member with a 1000 mm² base area, enter 0.6. | area_10 | 1 | |
| End joints | pair_11 | Off — member not present | |
| Area multiplier (× base area) For a 600 mm² member with a 1000 mm² base area, enter 0.6. | area_11 | 1 | |
| End joints | pair_12 | Off — member not present | |
| Area multiplier (× base area) For a 600 mm² member with a 1000 mm² base area, enter 0.6. | area_12 | 1 |
Results
With the default inputs above, the calc gives:
| Result | Value |
|---|---|
| Peak tension | 12.5 kN |
| Peak compression (magnitude) | 15 kN |
| Largest joint displacement | 0.6535 mm |
| Largest absolute axial stress | 15 MPa |
| Elastic strain energy | 6.4375 J |
Checked against sources
Each case below was calculated by this calc and agrees with the value from its source (within the tolerance where one is shown).
CALFEM exs3 — unequal-area three-bar truss
Source: Independent CALFEM FEM example exs3: A. Ottosson (2010), Implementation of CALFEM for Python, Appendix C, attached PDF pages 44–47 (printed 37–40). E=200 GPa; areas=600,300,1000 mm²; P_y at joint 3=-80 kN. The full displacement and reaction listing is on PDF page 46; member forces are on page 47. Also reproduced in the official current manual, exs_bar2: https://calfem-python-manual.readthedocs.io/en/latest/examples.html#exs-bar2
Inputs: Truss layout = Custom — up to 6 joints, 12 members; x coordinate = 0 m; y coordinate = 1.2 m; x coordinate = 1.6 m; x coordinate = 1.6 m; y coordinate = 1.2 m; Support restraint = Pinned — x and y fixed; Support restraint = Free joint; Support restraint = Pinned — x and y fixed; End joints = J1 — J3; End joints = J3 — J4; End joints = J2 — J3; Area multiplier (× base area) = 0.6; Area multiplier (× base area) = 0.3; Applied force y (+ up) = 0 kN; Applied force y (+ up) = -80 kN; End joints = Off — member not present; End joints = Off — member not present; End joints = Off — member not present; End joints = Off — member not present; the others as above.
| Result | Source | This calc |
|---|---|---|
| Horizontal joint displacements [3] | -0.3979 mm | -0.3979 mm |
| Vertical joint displacements [3] | -1.152 mm | -1.152 mm |
| Member forces (positive tension) [1] | -29.845 kN | -29.845 kN |
| Member forces (positive tension) [2] | 57.617 kN | 57.617 kN |
| Member forces (positive tension) [3] | 37.306 kN | 37.306 kN |
| Horizontal support reactions [1] | 29.845 kN | 29.845 kN |
| Horizontal support reactions [2] | -29.845 kN | -29.845 kN |
| Vertical support reactions [2] | 22.383 kN | 22.383 kN |
| Vertical support reactions [4] | 57.617 kN | 57.617 kN |
CALFEM exs_bar2_l — redundant ten-bar cantilever
Source: Independent published CALFEM FEM results, official current manual exs_bar2_l: https://calfem-python-manual.readthedocs.io/en/latest/examples.html#exs-bar2-l . E=210 GPa, A=2500 mm², force at joint 6=(250,-433.012701892) kN. Uses the corrected ten-row connectivity from the online manual. The attached 2010 report's Appendix D (PDF pages 49–51) is internally inconsistent: its code lists only nine malformed connectivity rows, reports displacement -1.81618691e+12, and contradicts its prose. Those invalid code outputs are not reference targets. Its page 51 prose agrees with the corrected online displacements, reactions and largest force. Tolerances allow published rounding.
Inputs: Truss layout = Custom — up to 6 joints, 12 members; Young's modulus (all members) = 210 GPa; Base cross-sectional area = 2,500 mm²; y coordinate = 2 m; x coordinate = 0 m; Support restraint = Pinned — x and y fixed; Applied force y (+ up) = 0 kN; x coordinate = 2 m; y coordinate = 2 m; Support restraint = Free joint; x coordinate = 2 m; y coordinate = 0 m; x coordinate = 4 m; x coordinate = 4 m; y coordinate = 0 m; Applied force x (+ right) = 250 kN; Applied force y (+ up) = -433 kN; End joints = J1 — J3; End joints = J2 — J4; End joints = J3 — J5; End joints = J4 — J6; End joints = J3 — J4; End joints = J5 — J6; End joints = J2 — J3; End joints = J4 — J5; End joints = J1 — J4; End joints = J3 — J6; the others as above.
| Result | Source | This calc |
|---|---|---|
| Horizontal joint displacements [6] | -1.659 mm | -1.659 mm |
| Vertical joint displacements [6] | -11.334 mm | -11.334 mm |
| Member forces (positive tension) [1] | 625.9 kN | 625.9 kN |
| Member forces (positive tension) [2] | -423.1 kN | -423.1 kN |
| Member forces (positive tension) [3] | 170.6 kN | 170.6 kN |
| Member forces (positive tension) [4] | -12.373 kN | -12.373 kN |
| Member forces (positive tension) [5] | -69.447 kN | -69.447 kN |
| Member forces (positive tension) [6] | 170.6 kN | 170.6 kN |
| Member forces (positive tension) [7] | -272.8 kN | -272.8 kN |
| Member forces (positive tension) [8] | -241.3 kN | -241.3 kN |
| Member forces (positive tension) [9] | 339.5 kN | 339.5 kN |
| Member forces (positive tension) [10] | 371.1 kN | 371.1 kN |
| Horizontal support reactions [1] | -866 kN | -866 kN |
| Horizontal support reactions [2] | 616 kN | 616 kN |
| Vertical support reactions [1] | 240.1 kN | 240.1 kN |
| Vertical support reactions [2] | 192.9 kN | 192.9 kN |
CALFEM exs3 — equivalent US-unit input
Source: Independent CALFEM FEM example exs3: A. Ottosson (2010), Implementation of CALFEM for Python, Appendix C, attached PDF pages 44–47 (printed 37–40). E=200 GPa; areas=600,300,1000 mm²; P_y at joint 3=-80 kN. The full displacement and reaction listing is on PDF page 46; member forces are on page 47. Also reproduced in the official current manual, exs_bar2: https://calfem-python-manual.readthedocs.io/en/latest/examples.html#exs-bar2 The same published case is entered in inches, square inches, ksi and kip to verify unit parsing and numerical equivalence; expected values remain in the steps' declared SI units.
Inputs: Truss layout = Custom — up to 6 joints, 12 members; Young's modulus (all members) = 29007.54754604184 ksi; Base cross-sectional area = 1.5500031000062 in^2; x coordinate = 0 in; y coordinate = 0 in; x coordinate = 0 in; y coordinate = 47.24409448818898 in; x coordinate = 62.99212598425198 in; y coordinate = 0 in; x coordinate = 62.99212598425198 in; y coordinate = 47.24409448818898 in; Support restraint = Pinned — x and y fixed; Support restraint = Free joint; Support restraint = Pinned — x and y fixed; End joints = J1 — J3; End joints = J3 — J4; End joints = J2 — J3; Area multiplier (× base area) = 0.6; Area multiplier (× base area) = 0.3; Applied force y (+ up) = 0 kN; Applied force y (+ up) = -17.98471550967684 kip; End joints = Off — member not present; End joints = Off — member not present; End joints = Off — member not present; End joints = Off — member not present; the others as above.
| Result | Source | This calc |
|---|---|---|
| Horizontal joint displacements [3] | -0.3979 mm | -0.3979 mm |
| Vertical joint displacements [3] | -1.152 mm | -1.152 mm |
| Member forces (positive tension) [1] | -29.845 kN | -29.845 kN |
| Member forces (positive tension) [2] | 57.617 kN | 57.617 kN |
| Member forces (positive tension) [3] | 37.306 kN | 37.306 kN |
| Horizontal support reactions [1] | 29.845 kN | 29.845 kN |
| Horizontal support reactions [2] | -29.845 kN | -29.845 kN |
| Vertical support reactions [2] | 22.383 kN | 22.383 kN |
| Vertical support reactions [4] | 57.617 kN | 57.617 kN |







Responses