STR-LAB

2D Frame Analysis Tool — Theory of Computation

kozo.info structural design tools  |  Version 1.2 / July 2026

1. Overview of the Method

STR-LAB is a linear elastic analysis tool that solves planar frame structures (rigid frames, trusses, continuous beams, etc.) with the direct stiffness method. Also known as the matrix displacement method, it is the application of the finite element method to framed structures and is the most widely used approach in both practice and education.

The analysis proceeds through the following steps, all executed in JavaScript inside your browser.

Build member stiffness matrices
Transform coordinates
Assemble the global stiffness matrix
Build the load vector
Apply boundary conditions
Solve the equations
Compute reactions & internal forces

The governing equation of the whole system is:

K · U = F

  K : global stiffness matrix (number of DOFs × number of DOFs)
  U : nodal displacement vector (unknowns)
  F : nodal load vector (nodal loads + equivalent nodal forces from member loads)

2. Modeling Assumptions

ItemAssumption
Structural systemPlanar frame in the XY plane (2D frame)
Beam theoryEuler–Bernoulli beam (bending + axial deformation; shear deformation is neglected)
MaterialLinear elastic (Hooke's law), characterized by Young's modulus E
DeformationSmall-deformation theory; geometric nonlinearity (P-Δ effect, buckling) is not considered
Degrees of freedom3 DOFs per node: horizontal displacement u, vertical displacement v, rotation θ
MembersStraight members connecting two nodes; properties (E, A, I) constant along each member
ConnectionsRigid or pinned can be specified independently at the i-end and j-end of each member

3. Coordinates and Sign Conventions

Global coordinate system: Y↑ │ └──────→ X Z (out of plane): positive toward the viewer (right-handed) Rotations / moments: counterclockwise (CCW) positive Member local coordinate system: y_local ↑ │ i-end ────────┼────────── j-end x_local → x_local: direction from the i-end to the j-end y_local: x_local rotated 90° counterclockwise Member DOF ordering (6 components): d = [ u_i, v_i, θ_i, u_j, v_j, θ_j ]ᵀ Positive internal forces (as displayed): N (axial force) : tension positive Q (shear force) : downward on the right face at the i-end positive M (bending moment): counterclockwise (CCW) positive
Internally, the end forces at the j-end are obtained as "outward forces acting on the node". For display, their signs are flipped so that both ends follow the same engineering sign convention (tension positive, CCW positive).

4. Member Stiffness Matrix

The stiffness matrix k in member local coordinates is 6×6, built from the axial stiffness EA/L and the bending stiffness EI. Four variants are used depending on the combination of end conditions (rigid / pinned).

4.1 Rigid at both ends (standard frame member)

        u_i        v_i        θ_i        u_j        v_j        θ_j
   ┌                                                              ┐
N_i│  EA/L        0          0         -EA/L       0          0   │
Q_i│   0      12EI/L³     6EI/L²        0      -12EI/L³    6EI/L² │
M_i│   0       6EI/L²     4EI/L         0       -6EI/L²    2EI/L  │
N_j│ -EA/L        0          0          EA/L       0          0   │
Q_j│   0     -12EI/L³    -6EI/L²        0       12EI/L³   -6EI/L² │
M_j│   0       6EI/L²     2EI/L         0       -6EI/L²    4EI/L  │
   └                                                              ┘

This matrix is derived from the exact Euler–Bernoulli solution (cubic deflection function), so as long as no loads act within the member, exact nodal displacements are obtained without subdividing the member.

4.2 Pinned ends — static condensation

A pinned end transmits no moment (M = 0), so its rotational degree of freedom is eliminated from the stiffness matrix by static condensation. The general formula is:

Partition into retained DOFs a and eliminated DOFs b (the pin-end rotation):

  k̃_aa = k_aa − k_ab · k_bb⁻¹ · k_ba

(The pin-end rotation follows dependently from the condition M = 0,
 so it can be removed from the unknowns.)

Pinned i-end, rigid j-end

   ┌                                                          ┐
   │  EA/L       0         0      -EA/L       0         0     │
   │   0       3EI/L³      0        0      -3EI/L³   3EI/L²   │
   │   0         0         0        0         0         0     │
   │ -EA/L       0         0       EA/L       0         0     │
   │   0      -3EI/L³      0        0       3EI/L³  -3EI/L²   │
   │   0       3EI/L²      0        0      -3EI/L²   3EI/L    │
   └                                                          ┘

Rigid i-end, pinned j-end

   ┌                                                          ┐
   │  EA/L       0         0      -EA/L       0         0     │
   │   0       3EI/L³   3EI/L²      0      -3EI/L³      0     │
   │   0       3EI/L²   3EI/L       0      -3EI/L²      0     │
   │ -EA/L       0         0       EA/L       0         0     │
   │   0      -3EI/L³  -3EI/L²      0       3EI/L³      0     │
   │   0         0         0        0         0         0     │
   └                                                          ┘

Pinned at both ends (truss member)

   ┌                                      ┐
   │  EA/L    0    0   -EA/L    0    0    │
   │   0      0    0     0      0    0    │
   │   0      0    0     0      0    0    │      transmits axial force only
   │ -EA/L    0    0    EA/L    0    0    │      (no bending stiffness)
   │   0      0    0     0      0    0    │
   │   0      0    0     0      0    0    │
   └                                      ┘
The change in the bending terms from 12EI/L³ to 3EI/L³ for a single pinned end corresponds to the fact that a fixed–pinned beam has 1/4 the stiffness of a fixed–fixed beam.

5. Ignoring Axial Deformation (Analysis Setting)

When "Axial deformation: ignored" is selected in the analysis settings, a penalty method treats the axial stiffness of members as effectively infinite. Hand-calculation methods (moment distribution, D-value method, etc.) normally neglect axial deformation, so this setting is convenient for comparison with them.

EA/L  →  10⁵ × max( EA/L,  12EI/L³ )

  - The axial stiffness is raised to 100,000 times the representative bending
    stiffness, making axial elongation practically zero.
  - It is not made truly infinite so that Gaussian elimination with partial
    pivoting stays free of catastrophic cancellation.
Note: Because of the penalty approximation, extremely small errors (on the order of 10⁻⁵) remain in axial forces and displacements. Changing the axial deformation setting does not automatically re-run the analysis — always press "Run Analysis" again.

6. Coordinate Transformation

Since each member has its own orientation, the local stiffness matrix is transformed into the global coordinate system before assembly. With direction cosines c = cos θ = Δx/L and s = sin θ = Δy/L, the transformation matrix T is:

        ┌                    ┐
        │  c   s   0          │
        │ -s   c   0     0    │
        │  0   0   1          │
   T =  │                    │        d_local = T · d_global
        │          c   s   0 │
        │    0    -s   c   0 │
        │          0   0   1 │
        └                    ┘

Member stiffness matrix in global coordinates:

   k_global = Tᵀ · k_local · T

7. Assembling the Global Stiffness Matrix

With n nodes, the total number of DOFs is 3n. Node i is assigned the DOFs (3i, 3i+1, 3i+2) = (u, v, θ). The components of each member's k_global (6×6) are added into the global matrix K (3n×3n) according to the DOF numbers of the member's two end nodes — hence the name "direct stiffness method".

for each member:
    dofs = [3i, 3i+1, 3i+2, 3j, 3j+1, 3j+2]   (i, j = end node indices)
    for a = 1..6, b = 1..6:
        K[dofs[a]][dofs[b]] += k_global[a][b]

8. Load Handling

8.1 Nodal loads

Concentrated forces Px, Py and concentrated moments Mz acting directly on nodes are added as-is to the corresponding DOFs of the load vector F.

8.2 Member loads → equivalent nodal forces

Loads acting along a member (concentrated or distributed) cannot enter F directly. They are converted into equivalent nodal forces based on fixed-end forces and distributed to the two end nodes.

Concentrated load (Type 1) — closed-form solution

Fixed-end forces for a concentrated load P at distance a from the i-end (b = L − a):

Q_i = P·b²·(3a + b) / L³
M_i = P·a·b² / L²
Q_j = P·a²·(a + 3b) / L³
M_j = −P·a²·b / L²

Distributed loads (Types 2–5) — numerical integration

A distributed load is treated as a series of infinitesimal concentrated loads q(x)·dx at position x, and the fixed-end force formulas above are numerically integrated over the member length. Simpson's rule with 100 subdivisions is used, which gives ample accuracy for linearly varying load shapes such as trapezoids and triangles.

Q_i = ∫₀ᴸ q(x) · (L−x)²(3x + (L−x)) / L³ dx
M_i = ∫₀ᴸ q(x) · x(L−x)² / L² dx
(similarly for Q_j and M_j)

Pin-end correction

The fixed-end force formulas assume rigid connections at both ends. For members with pinned ends, a correction "sets the pin-end moment back to zero and redistributes it into the shear forces".

Pinned i-end:      Q_i += M_i/L,   Q_j −= M_i/L,   M_i = 0
Pinned j-end:      Q_i −= M_j/L,   Q_j += M_j/L,   M_j = 0
Pinned both ends:  Q_i += (M_i−M_j)/L,  Q_j −= (M_i−M_j)/L,  M_i = M_j = 0

Resolving the load direction

Member loads can be specified in four directions. Loads in global directions (3 and 4) are resolved into local components using the member's direction cosines (c, s) before the equivalent nodal forces are computed; the resulting forces are then transformed back into global coordinates and added to F.

DirectionMeaningResolution into local components
1Local Y (perpendicular to the member axis)q_y = p1
2Local X (along the member axis)q_x = p1
3Global Y (vertical)q_y = c·p1, q_x = s·p1
4Global X (horizontal)q_y = −s·p1, q_x = c·p1
The axial (local X) component is simplified by treating it as uniformly distributed over the full length and assigning half to each end (q_x·L/2). This applies to Types 1 and 2 only.

9. Boundary Conditions and Prescribed Displacements (Partition Method)

Support conditions (restraints on dx, dy, rz) and prescribed displacements (support settlement, imposed rotation) are handled by the partition method, which splits the global stiffness equation into free DOFs (f) and constrained DOFs (c).

┌ K_ff  K_fc ┐ ┌ U_f ┐   ┌ F_f ┐
│            │ │     │ = │     │
└ K_cf  K_cc ┘ └ U_c ┘   └ F_c ┘

  U_f : unknown free displacements
  U_c : prescribed displacements (0 for ordinary supports, or the entered value)

Extract and solve only the upper block:

  K_ff · U_f = F_f − K_fc · U_c

After solving, substitute U_c (the prescribed values) into the constrained
components of U to obtain the complete displacement vector.

The −K_fc·U_c term on the right-hand side transfers the effect of support settlement or imposed rotation exactly onto the load side, so the specified values are reflected precisely in the nodal displacements, reactions and internal forces.

Note: To apply a prescribed displacement, the target DOF must be restrained (☑) in the Nodes table. Prescribed values entered for free DOFs are ignored.

10. Solving the Simultaneous Equations

K_ff · U_f = F̃_f is solved with Gaussian elimination with partial pivoting. Selecting the row with the largest absolute value as the pivot at each elimination step ensures numerical stability.

1. Forward elimination: for each column, swap in the row with the largest
   |value| and eliminate the lower triangle
2. Singularity check: if the absolute pivot value is below 10⁻¹⁴, raise the
   error "The structural system is singular or unstable"
   (caused by insufficient restraints, a mechanism, or disconnected members)
3. Back-substitution yields U_f

11. Computing Reactions

Once the complete displacement vector U is known, reactions at the constrained DOFs are computed from the residual of the global stiffness equation.

R_i = Σ_j K[i][j] · U[j] − F[i]      (i: constrained DOF)

  Because F[i] includes the equivalent nodal forces, support reactions
  due to member loads are also computed correctly.
Verification: You can confirm that force equilibrium (ΣFx = 0, ΣFy = 0, ΣM = 0) holds between all reactions and all loads.

12. Member End Forces and Internal Force Diagrams

12.1 End forces

For each member, the global displacements are transformed back to local coordinates and multiplied by the member stiffness to obtain the end forces.

d_local = T · d_global                    (6 displacement components of both ends)
f_local = k_local · d_local − f_fixed     (subtract the fixed-end forces)

  f_fixed: equivalent nodal forces of the member loads acting on this member
           (local coordinates). Subtracting them correctly combines
           "forces due to displacement + direct effect of member loads".

Sign handling for display:
  i-end : N_i =  f₁,  Q_i =  f₂,  M_i =  f₃
  j-end : N_j = −f₄,  Q_j = −f₅,  M_j = −f₆   (outward force → engineering sign)

12.2 Internal forces along the member (N, Q, M diagrams)

For drawing the diagrams, the internal forces at any point x (0 ≤ x ≤ L) are computed starting from the i-end forces and integrating the member loads.

N(x) = N_i + ∫₀ˣ q_x(ξ) dξ
Q(x) = Q_i + ∫₀ˣ q_y(ξ) dξ
M(x) = M_i − Q_i·x − ∫₀ˣ q_y(ξ)·(x − ξ) dξ

  - Concentrated loads (Type 1) cause discontinuous changes in the slopes of
    Q and M at the load point (handled analytically)
  - Distributed loads are integrated numerically with the trapezoidal rule
    (for drawing purposes)

13. Drawing the Deformed Shape

The deformed shape is drawn by approximating the Euler–Bernoulli deflection curve (a cubic) with a cubic Bezier curve constructed from the end displacements and rotations (u, v, θ) obtained in the analysis. The end rotations are used as tangent directions, so continuity at rigid connections and kinks at pinned connections are clearly visible. On screen, the deformation is amplified by the "deformation scale", which can be changed with the zoom buttons.

The deformed shape is a display based on nodal displacements and rotations. Additional deflection within a member due to large mid-span loads is simplified.

14. Verification Examples

The validity of the method can be checked by comparing simple models against theoretical solutions.

Verification 1: Cantilever beam with a concentrated load at the free end

Length L, concentrated load P (downward) at the free end.

Fixed-end moment: M = P·L
Free-end deflection: δ = P·L³ / (3EI)
Example: P = 10,000 N, L = 3,000 mm → M = 30,000,000 N·mm
Verification 2: Simply supported beam with a uniform load

Span L, uniform load w (downward; Type 3 with p1 = p2 = −w).

Midspan moment: M = w·L² / 8
Midspan deflection: δ = 5w·L⁴ / (384EI)
Example: w = 1.0 N/mm, L = 6,000 mm → M = 4,500,000 N·mm
Verification 3: Fixed–fixed beam with a uniform load
End moment: M = w·L² / 12 / Midspan moment: M = w·L² / 24
Midspan deflection: δ = w·L⁴ / (384EI)

15. Scope and Limitations

  1. Linear elastic analysis only — plasticity and material nonlinearity are not handled.
  2. Small-deformation theory — geometric nonlinearity such as the P-Δ effect and buckling is not considered.
  3. Shear deformation is neglected — being Euler–Bernoulli beams, deep members (short span, large depth) are evaluated with somewhat smaller deflections than Timoshenko beam theory would give.
  4. Numerical precision — mixing members with extremely different stiffness ratios (EA/EI), or the "ignore axial deformation" setting (penalty method), can introduce small numerical errors.
  5. Units — the internal computation uses input values as-is (no unit conversion). The unit setting (N/kN, mm/cm) merely declares how values are interpreted; enter all input consistently in the selected unit system.
  6. Self-weight — not computed automatically. Enter it as member or nodal loads if needed.

Related pages: STR-LAB Frame Analysis Tool  |  User Manual  |  日本語版解説  |  Hyper Steel Section Tables  |  Seismic Isolation Simulator