Section 1.1 of Chapter 1: Two-Dimensional Truss Structures

Large Displacements of 2D Truss Structures

A total-potential-energy formulation for straight, prismatic two-node truss elements, including exact displacement kinematics, tangent stiffness, Newton–Raphson solution, and MATLAB implementations.

Linear elastic materialSmall strainLarge displacementMATLAB tested in R2017b and R2026a

01

Overview and assumptions

Consider a planar structure assembled from straight, prismatic truss elements. Each element has two nodes and carries axial force only.

MaterialLinear elastic
StrainSmall
DisplacementPotentially large

The global nodal-displacement and nodal-force vectors are denoted by u\boldsymbol{u} and F\boldsymbol{F}.

Notation

u\boldsymbol{u}
Nodal-displacement vector in the global reference frame
F\boldsymbol{F}
Nodal-force vector in the global reference frame
UU
Elastic deformation energy (internal energy)
VV
Potential of the applied nodal forces
σ, ε\sigma,\ \varepsilon
Axial stress and axial strain, respectively
EE
Young's modulus, with σ=Eε\sigma=E\varepsilon
Vel=AL\mathcal{V}_{el}=AL
Element volume; AA is the cross-sectional area and LL is the initial length

02

Element kinematics

Initial and displaced configurations of a two-node planar truss element
Figure 1. Initial and displaced configurations of a two-node truss element.

For initial nodal coordinates(x1,y1)(x_1,y_1) and(x2,y2)(x_2,y_2), the initial length is:

L=(x2x1)2+(y2y1)2L=\sqrt{(x_2-x_1)^2+(y_2-y_1)^2}

With element displacement vectoruel=(u1v1u2v2)T\boldsymbol{u}_{el}=\begin{pmatrix}u_1&v_1&u_2&v_2\end{pmatrix}^{T}, the deformed length becomes:

Lf=(x2x1+u2u1)2+(y2y1+v2v1)2L_f=\sqrt{(x_2-x_1+u_2-u_1)^2+(y_2-y_1+v_2-v_1)^2}

The engineering axial strain, constant along the element, is:

ε=LfLL=(x2x1+u2u1)2+(y2y1+v2v1)2LL\varepsilon=\frac{L_f-L}{L}=\frac{\sqrt{(x_2-x_1+u_2-u_1)^2+(y_2-y_1+v_2-v_1)^2}-L}{L}

Here, x1,x2,y1,y2x_1,x_2,y_1,y_2 are the nodal coordinates, andu1,u2,v1,v2u_1,u_2,v_1,v_2 are the corresponding nodal displacements.

03

Total potential energy

The total potential energy of the structure is the sum of the elastic deformation energy and the potential of the applied nodal forces. Here the applied loads are assumed to be conservative, displacement-independent nodal forces:

Π=U+V=12elVelεσdVuTF=12elVelEε2dVuTF\Pi=U+V=\frac{1}{2}\sum_{el}\int_{\mathcal{V}_{el}}\varepsilon\sigma\,d\mathcal{V}-\boldsymbol{u}^T\boldsymbol{F}=\frac{1}{2}\sum_{el}\int_{\mathcal{V}_{el}}E\varepsilon^2\,d\mathcal{V}-\boldsymbol{u}^T\boldsymbol{F}

The summation extends over the deformation energy of all truss elements. Because the strain is constant along each element, the structural energy becomes:

Π=12elEALε2uTF\Pi=\frac{1}{2}\sum_{el}EAL\varepsilon^2-\boldsymbol{u}^T\boldsymbol{F}

Since the strain is constant within a truss element of cross-sectional area AA,

Uel=12EALε2U_{el}=\frac{1}{2}EAL\varepsilon^2

The minimum-total-potential-energy principle requires

Ψ=Πu=UuF=0\boldsymbol{\Psi}=\frac{\partial\Pi}{\partial\boldsymbol{u}}=\frac{\partial U}{\partial\boldsymbol{u}}-\boldsymbol{F}=\boldsymbol{0}

Substitution of the element energy gives the nonlinear system in the nodal displacements:

Ψ=elEALεεuF=0\boldsymbol{\Psi}=\sum_{el}EAL\varepsilon\frac{\partial\varepsilon}{\partial\boldsymbol{u}}-\boldsymbol{F}=\boldsymbol{0}

04

Element force and tangent stiffness

At truss-element level, the deformation energy is:

Uel=12EAL[(x2x1+u2u1)2+(y2y1+v2v1)2LL]2U_{el}=\frac{1}{2}EAL\left[\frac{\sqrt{(x_2-x_1+u_2-u_1)^2+(y_2-y_1+v_2-v_1)^2}-L}{L}\right]^2

In general, the element internal-force vector and tangent stiffness matrix are obtained as derivatives of the element energy:

fel=Ueluel,kel=feluel=2Ueluel2\boldsymbol{f}_{el}=\frac{\partial U_{el}}{\partial\boldsymbol{u}_{el}},\qquad \boldsymbol{k}_{el}=\frac{\partial\boldsymbol{f}_{el}}{\partial\boldsymbol{u}_{el}}=\frac{\partial^2U_{el}}{\partial\boldsymbol{u}_{el}^2}
fel=EALεεuel\boldsymbol{f}_{el}=EAL\varepsilon\frac{\partial\varepsilon}{\partial\boldsymbol{u}_{el}}
kel=EAL[ε2εuel2+εuel(εuel)T]\boldsymbol{k}_{el}=EAL\left[\varepsilon\frac{\partial^2\varepsilon}{\partial\boldsymbol{u}_{el}^2}+\frac{\partial\varepsilon}{\partial\boldsymbol{u}_{el}}\left(\frac{\partial\varepsilon}{\partial\boldsymbol{u}_{el}}\right)^T\right]

For the complete structure, assembly gives:

Kt=elkel,Ψ=elfelF\boldsymbol{K}_t=\sum_{el}\boldsymbol{k}_{el},\qquad \boldsymbol{\Psi}=\sum_{el}\boldsymbol{f}_{el}-\boldsymbol{F}

The structural tangent matrix is the Hessian of the internal energy:

Kt=2Πu2=2Uu2=2(elUel)u2\boldsymbol{K}_t=\frac{\partial^2\Pi}{\partial\boldsymbol{u}^2}=\frac{\partial^2U}{\partial\boldsymbol{u}^2}=\frac{\partial^2\left(\sum_{el}U_{el}\right)}{\partial\boldsymbol{u}^2}
Assembly

The global tangent matrix is assembled using the same connectivity procedure as in a linear finite element model. The nonlinearity enters through the displacement-dependent element quantities.

05

Newton–Raphson solution

The nonlinear algebraic systemΨ=0\boldsymbol{\Psi}=\boldsymbol{0} is solved iteratively. At iterationii,

Δu(i)=(Kt(i))1Ψ(i)u(i+1)=u(i)+Δu(i)\Delta\boldsymbol{u}^{(i)}=-\left(\boldsymbol{K}_t^{(i)}\right)^{-1}\boldsymbol{\Psi}^{(i)}\qquad \boldsymbol{u}^{(i+1)}=\boldsymbol{u}^{(i)}+\Delta\boldsymbol{u}^{(i)}

A displacement-based convergence measure is:

η=ΔuTΔun<tol\eta=\sqrt{\frac{\Delta\boldsymbol{u}^T\Delta\boldsymbol{u}}{n}}<\mathrm{tol}

where nn is the number of active equations.

Important remark

The method is exact within the stated assumptions. Its accuracy does not depend on the number of load steps. Buckling of individual truss elements is not considered.

06

MATLAB implementation

The following symbolic MATLAB program computesfel\boldsymbol{f}_{el} andkel\boldsymbol{k}_{el} as derivatives of UelU_{el}.

k_sym.mSymbolic derivation
% k_sym
clear
syms x1 x2 u1 u2 y1 y2 v1 v2 L EA real
U=EA/2/L*(sqrt((x2-x1+u2-u1)^2+(y2-y1+v2-v1)^2)-L)^2;
fel=[diff(U,u1); diff(U,v1); diff(U,u2); diff(U,v2)];
fel=simplify(fel)
kel=[diff(fel,u1) diff(fel,v1) diff(fel,u2) diff(fel,v2)];
kel=simplify(kel)

The resulting expressions are copied into thestiff.m subroutine. The nonlinear analysis is started by running main.m, which calls:

  • gen.m — generates the numerical input data;
  • stiff.m — assembles and solves the nonlinear system iteratively;
  • strain_stress.m — computes strains and stresses in all truss elements.

The Newton–Raphson update in stiff.m is implemented as

stiff.mNewton–Raphson update
dS=-K\F;
S=S+dS;
err=sqrt(dS'*dS/neq);
Download the direct-derivative implementation — truss2D_1.zip

Exact strain derivatives and the compact approximation

Introduce the current element-axis components and two compact quantities:

qx=x2x1+u2u1,qy=y2y1+v2v1,a={qxqyqxqy}q_x=x_2-x_1+u_2-u_1,\qquad q_y=y_2-y_1+v_2-v_1,\qquad \boldsymbol{a}=\begin{Bmatrix}-q_x\\-q_y\\q_x\\q_y\end{Bmatrix}
G=[1010010110100101]\boldsymbol{G}=\begin{bmatrix}1&0&-1&0\\0&1&0&-1\\-1&0&1&0\\0&-1&0&1\end{bmatrix}

Direct differentiation ofε=Lf/L1\varepsilon=L_f/L-1 gives the exact gradient and Hessian:

εuel=1LLfa,2εuel2=1LLfG1LLf3aaT\frac{\partial\varepsilon}{\partial\boldsymbol{u}_{el}}=\frac{1}{LL_f}\boldsymbol{a},\qquad \frac{\partial^2\varepsilon}{\partial\boldsymbol{u}_{el}^2}=\frac{1}{LL_f}\boldsymbol{G}-\frac{1}{LL_f^3}\boldsymbol{a}\boldsymbol{a}^T

For very small axial deformation, one may set LfLL_f\approx L. The additional approximation2ε/uel2(1/L2)G\partial^2\varepsilon/\partial\boldsymbol{u}_{el}^2\approx(1/L^2)\boldsymbol{G} omits the second term of the exact Hessian:

εuel1L2a,2εuel21L2G\frac{\partial\varepsilon}{\partial\boldsymbol{u}_{el}}\approx\frac{1}{L^2}\boldsymbol{a},\qquad \frac{\partial^2\varepsilon}{\partial\boldsymbol{u}_{el}^2}\approx\frac{1}{L^2}\boldsymbol{G}

This is a computational approximation, not the exact second derivative obtained merely by substitutingLf=LL_f=L. The supplied deriv.m uses the exact expressions, while retaining their compact form.

Download the derivative-subroutine implementation — truss2D_2.zip
MATLAB verification

Tested in MATLAB R2017b and MATLAB R2026a. The derivative checks passed, all nonlinear solvers converged, the linear solution remained finite, and the two equivalent nonlinear implementations agreed to machine precision. The programs use standard MATLAB syntax and are expected to be compatible with intermediate and newer MATLAB versions.

07

Numerical examples

Example 1 — vertical loading

The complete numerical input data are given ingen.m. A vertical loadV=100 NV=100\ \mathrm{N} is applied at the free end. The deformed configurations and load–displacement curves show the strongly nonlinear geometric response of the structure.

Deformed truss configurations and normalized load-displacement curves
Figure 2. Deformed configurations and comparison of MATLAB and ANSYS load–displacement results.

Example 2 — combined horizontal and vertical loading

A horizontal load H=200 NH=200\ \mathrm{N} is added to the vertical loadV=100 NV=100\ \mathrm{N}. The MATLAB and ANSYS displacement results are identical to the displayed precision.

MATLAB deformed shape for combined horizontal and vertical loading
Figure 3a. MATLAB solution.
ANSYS deformed shape for combined horizontal and vertical loading
Figure 3b. ANSYS comparison.
Download the ANSYS comparison macro — Ansys_macro.zip

08

Extension to a nonlinear material

Example 3 — nonlinear material response

In Example 3, some element strains exceed 10%, so the small-strain material interpretation is no longer appropriate. In the formulation below,ε\varepsilon is engineering strain andσ\sigma is its work-conjugate nominal stress. If the relation is supplied as a nonlinear functionσ=f(ε)\sigma=f(\varepsilon), the elastic strain-energy density is the area under the stress–strain curve. Therefore,

Uel=AL0εσ(ξ)dξU_{el}=AL\int_0^\varepsilon\sigma(\xi)\,d\xi

The function σ(ε)\sigma(\varepsilon) is assumed to be known experimentally. Differentiation gives the consistent internal-force vector:

fel=ALσ(ε)εuel\boldsymbol{f}_{el}=AL\,\sigma(\varepsilon)\frac{\partial\varepsilon}{\partial\boldsymbol{u}_{el}}

With the material tangentEt=dσ/dεE_t=d\sigma/d\varepsilon, the consistent element tangent is:

kel=AL[Etεuel(εuel)T+σ2εuel2]\boldsymbol{k}_{el}=AL\left[E_t\frac{\partial\varepsilon}{\partial\boldsymbol{u}_{el}}\left(\frac{\partial\varepsilon}{\partial\boldsymbol{u}_{el}}\right)^T+\sigma\frac{\partial^2\varepsilon}{\partial\boldsymbol{u}_{el}^2}\right]
Nonlinear stress-strain curve used in the material example
Figure 4. Tabulated nonlinear stress–strain relation used in the example.

The tangent σ/ε\partial\sigma/\partial\varepsilon is computed from the same shape-preserving interpolation used for the tabulated stress–strain relation. The program uses this material tangent together with the exact strain Hessian, so the assembled matrix is consistent with the internal-force vector.

Scope of Example 3

In this example, the strains are large and the material response is nonlinear.

Download the nonlinear-material implementation — truss2D_3.zip

09

Linear limiting case

When both displacement and strain are small, retaining only first-order terms in the deformation expression gives:

ε=(x2x1+u2u1)2+(y2y1+v2v1)2LL(u2u1)(x2x1)L2+(v2v1)(y2y1)L2\varepsilon=\frac{\sqrt{(x_2-x_1+u_2-u_1)^2+(y_2-y_1+v_2-v_1)^2}-L}{L}\approx\frac{(u_2-u_1)(x_2-x_1)}{L^2}+\frac{(v_2-v_1)(y_2-y_1)}{L^2}

This follows from1+a1+a/2\sqrt{1+a}\approx1+a/2 for a1a\ll1. The resulting problem is linear, with loads proportional to displacements. The strain derivatives are:

εuel=1L2{(x2x1)(y2y1)x2x1y2y1}=1L{cosθsinθcosθsinθ},2εuel2=04×4\frac{\partial\varepsilon}{\partial\boldsymbol{u}_{el}}=\frac{1}{L^2}\begin{Bmatrix}-(x_2-x_1)\\-(y_2-y_1)\\x_2-x_1\\y_2-y_1\end{Bmatrix}=\frac{1}{L}\begin{Bmatrix}-\cos\theta\\-\sin\theta\\\cos\theta\\\sin\theta\end{Bmatrix},\qquad \frac{\partial^2\varepsilon}{\partial\boldsymbol{u}_{el}^2}=\boldsymbol{0}_{4\times4}

The linear element stiffness matrix is therefore:

kel=EALεuel(εuel)T\boldsymbol{k}_{el}=EAL\frac{\partial\varepsilon}{\partial\boldsymbol{u}_{el}}\left(\frac{\partial\varepsilon}{\partial\boldsymbol{u}_{el}}\right)^T

With c=cosθc=\cos\theta and s=sinθs=\sin\theta, this becomes:

kel=EAL[c2csc2cscss2css2c2csc2cscss2css2]\boldsymbol{k}_{el}=\frac{EA}{L}\begin{bmatrix}c^2&cs&-c^2&-cs\\cs&s^2&-cs&-s^2\\-c^2&-cs&c^2&cs\\-cs&-s^2&cs&s^2\end{bmatrix}
Download the linear implementation — truss2D_linear.zip

10

MATLAB program files

Each archive contains the MATLAB source files and supporting data for the corresponding implementation.