01
Model and assumptions
Consider a straight cantilever beam of length , constant cross-section, and linear elastic material. The free end is subjected to the force components and , and to an end couple .
The Euler–Bernoulli model is used. The neutral axis is treated as inextensible and the rotation is the slope of the deformed neutral axis. For this finite-difference formulation, is positive to the right and is positive downward, exactly as defined in Figure 1 and in the program.

- Young's modulus
- Geometrical moment of inertia of the cross-section
- Bending moment
- Curvature
- Arc-length coordinate along the neutral axis
02
Beam equilibrium
At an arbitrary point of the deformed beam, the bending moment follows from equilibrium of the free-end loads:
The exact kinematic relations for the inextensible centerline are:
The boundary condition at the clamped end is . The free-end coordinates and are part of the nonlinear solution.
03
Finite-difference equations
Divide the beam into equal intervals of length . Node 1 is at the clamp and node is at the free end. Writing the equilibrium equation at the midpoint between nodes and gives:
With , the first residual equation is:
Subtracting adjacent midpoint equations eliminates the free-end coordinates from the remaining equations. For ,
The centerline is reconstructed after each update from the midpoint rotations:
04
Modified Newton iteration
The residual vector has components. Its local equations use the exact derivatives shown by the program. In the first tangent equation, however, the current values of and are held fixed. The method is therefore a modified Newton iteration, not a full Newton method.
For the strongly nonlinear example below, the program uses . This small relaxation factor makes the modified iteration robust when the free-end displacement is already large. For load factors below about , the program can use and convergence is much faster.
The first row is intentionally approximate because it freezes the current free-end coordinates. The remaining rows are differentiated exactly. This is the iteration implemented and verified here.
05
MATLAB implementation
The program is a single commented MATLAB script. It defines the beam, assembles the residual and tangent matrix, applies the under-relaxed rotation correction, and reconstructs the deformed centerline.
% Under-relaxed correction of the nodal rotations.
df = J\psi;
df = [0; df];
f = f - sr*df;
err = sqrt(df'*df/(2*n));
% Reconstruct the centerline from midpoint rotations.
fm = (f(2:n)+f(1:n-1))/2;
x = [0; cumsum(cos(fm)*h)];
y = [0; cumsum(sin(fm)*h)];Tested in MATLAB R2017b and MATLAB R2026a. The code uses standard MATLAB syntax and is expected to be compatible with intermediate and newer MATLAB versions. It uses only core MATLAB functions and does not require an additional toolbox.
06
Numerical examples
The beam has , a rectangular cross-section (width × thickness), and .



07
Program files
The archive contains the commented solver, a numerical Jacobian-check script, and a README describing the sign convention and iteration method.
08
References
- K. Mattiasson, “Numerical results from large deflection beam and frame problems analysed by means of elliptic integrals,” International Journal for Numerical Methods in Engineering, vol. 16, pp. 145–153, 1981.