01
Model, hypotheses, and reference frames
Each beam element has a local reference frame , whose orientation is fixed with respect to the global frame of the structure. Under loading, the structure deforms and each element reaches a new position characterized by the frame .
For each beam element, the nodal displacements are expressed in the local reference frame attached to the initial undeformed element. The axial force, shear force, and bending moment are evaluated in this local frame and transformed to the global frame during assembly. Thus, in the Total Lagrangian formulation, both element displacements and internal forces are evaluated with respect to the initial local frame .

02
Element transformation
The initial orientation of the undeformed beam element with respect to the global frame is defined by the rotation matrix:
For an element joining nodes 1 and 2,
The matrix is determined from the initial geometry and remains fixed throughout the Total Lagrangian analysis.
%*** gen ***
Rt = zeros(6,6,nel);
for ie = 1:nel
n1 = elem(ie,1);
n2 = elem(ie,2);
dx = x(n2)-x(n1);
dy = y(n2)-y(n1);
L = sqrt(dx*dx+dy*dy);
cs = dx/L;
sn = dy/L;
Lt(ie) = L;
Rt(:,:,ie) = [ cs sn 0 0 0 0;
-sn cs 0 0 0 0;
0 0 1 0 0 0;
0 0 0 cs sn 0;
0 0 0 -sn cs 0;
0 0 0 0 0 1];
end03
Extension of the element formulation
The formulation developed in Section 7.1 is extended to beam structures with only minor modifications. The programs main.m and deriv.m remain unchanged in their mechanics.
The global element-displacement vector is transformed to the initial local frame before the generalized strains and their derivatives are evaluated:
R = Rt(:,:,ie);
s = R*S(ip);The element internal-force vector and tangent stiffness matrix are transformed back to the global frame during assembly:
F(ip) = F(ip) + R'*fel;
K(ip,ip) = K(ip,ip) + R'*kel*R;Important remark. In the Total Lagrangian formulation presented here, the reference configuration remains the initial undeformed configuration throughout the analysis. Consequently, no incremental approximation associated with the number of load steps is introduced. Within the adopted assumptions, the converged solution is therefore essentially independent of the chosen number of load steps; several load steps may still be useful for tracing the equilibrium path and facilitating convergence.
04
Example 1 — semicircular beam
The beam has radius , a rectangular cross-section (width × thickness), Young's modulus , and horizontal load .
The figure shows the deformed beam at four equally spaced load levels. For the final load , the MATLAB solution is compared with ANSYS, showing very good agreement.

05
Internal-force diagrams
The axial-force, shear-force, and bending-moment diagrams correspond to the final load step. They were plotted using the MATLAB program diagrams.m.



06
Example 2 — Mattiasson benchmark
This benchmark is taken from Mattiasson [1], where reference solutions for large-deflection beam and frame problems are obtained using elliptic integrals. The two symmetric loading cases and the displacement components used in the comparison are shown below.

The numerical results are compared with the reference solution from [1], and very good agreement is obtained.

07
MATLAB and ANSYS packages
The MATLAB package contains the complete beam-structure analysis, including model generation, local-to-global transformations, nonlinear assembly, result printing, and effort diagrams. The ANSYS package contains the comparison model for Example 1.
Tested in MATLAB R2024a. All ten load steps of the distributed example converged in six to eight Newton–Raphson iterations. The code uses standard MATLAB syntax and is expected to be compatible with newer MATLAB versions. No additional toolbox is required.
08
Reference
- K. Mattiasson, Numerical results from large deflection beam and frame problems analysed by means of elliptic integrals, International Journal for Numerical Methods in Engineering, 16, 145–153, 1981.