Stiffness Matrix Calculator
Enter the element type and section properties to get the local element stiffness matrix and, for inclined elements, the rotation transformation matrix and assembled global stiffness matrix. The calculator covers 2D truss (axial-only, 4x4), 2D beam (bending, 4x4 Euler-Bernoulli), and 2D frame (combined, 6x6) elements. Results update instantly as you type and a worked steps panel shows how every coefficient is derived.
What is a stiffness matrix?
A stiffness matrix is the fundamental building block of the direct stiffness method (also called the finite element method for structural analysis). It relates the nodal forces and moments of a single structural element to the nodal displacements and rotations through the equation F = K * d, where F is the vector of forces, K is the stiffness matrix, and d is the vector of displacements. Each entry K[i,j] represents the force at DOF i when a unit displacement is applied at DOF j and all other DOFs are held fixed. Assembling the individual element matrices into a global structure stiffness matrix and then solving the system gives the unknown displacements of every node in the structure.
How the Euler-Bernoulli beam stiffness matrix is derived
The classic 4x4 beam element stiffness matrix comes from integrating the virtual work equation for an Euler-Bernoulli beam (which assumes plane sections remain plane and ignores shear deformation). The cubic Hermite shape functions that exactly satisfy the beam differential equation produce four coefficients - 12EI/L^3, 6EI/L^2, 4EI/L, and 2EI/L - that populate the matrix. The 12EI/L^3 terms link transverse shear to transverse displacement; the 4EI/L and 2EI/L terms link bending moment to nodal rotations; and the 6EI/L^2 terms are coupling terms between displacement and rotation. These are exact for a uniform prismatic beam with no distributed load within the element.
Truss, beam, and frame: choosing the right element type
A 2D truss element carries only axial forces, so its local stiffness matrix has a simple 2x2 block (AE/L) expanded to 4x4 by including the transverse DOFs, which have zero stiffness locally. It must be inclined in 2D space and transformed to global coordinates. A 2D beam element adds bending and shear (4x4) but assumes the member is connected by pins at the joints for axial load transfer - axial DOFs are not included. A 2D frame element is the most general: it combines axial stiffness and bending stiffness in a 6x6 matrix, making it suitable for rigid-jointed frames where both axial and flexural forces are transferred at the connections.
The transformation matrix and global stiffness
The local stiffness matrix is derived in the element coordinate system (the x-axis along the element). When a member is inclined at angle theta to the global x-axis, a transformation matrix T (built from direction cosines c = cos(theta) and s = sin(theta)) is used to rotate the local matrix into global coordinates: K_global = T^T * K_local * T. This global element matrix can then be directly assembled into the structure stiffness matrix by adding the element coefficients to the appropriate global DOF positions. For a horizontal element (theta = 0), the transformation matrix is the identity and K_global equals K_local.
Degrees of freedom (DOF) by element type
| Element type | Matrix size | DOF order | Forces/moments carried |
|---|---|---|---|
| 2D Truss | 4x4 | [u1, v1, u2, v2] | Axial force only |
| 2D Beam | 4x4 | [v1, theta1, v2, theta2] | Shear + bending moment |
| 2D Frame | 6x6 | [u1, v1, theta1, u2, v2, theta2] | Axial + shear + bending |
DOF labels define what each row and column of the stiffness matrix corresponds to.
Frequently asked questions
What units should I use for inputs?
The calculator accepts a range of units and converts them to SI internally. You can enter Young's modulus in GPa (typical for steel and metals), MPa (concrete, polymers), Pa, ksi, or psi. Area can be in cm2, mm2, m2, or in2. Second moment of area (I) can be in cm4, mm4, m4, or in4. Length can be in m, mm, cm, ft, or in. All matrix coefficients in the output are in SI base units (N/m for the translational stiffness terms, N for the shear-moment coupling terms, and N-m for the rotational stiffness terms).
Why is the stiffness matrix singular?
A free (unrestrained) element stiffness matrix is always singular - its determinant is zero. This is because no boundary conditions have been applied, so the structure is free to translate and rotate as a rigid body without any internal deformation. When you apply supports (set displacement DOFs to zero) by deleting the corresponding rows and columns, the reduced stiffness matrix becomes positive definite and invertible, allowing you to solve for the remaining unknown displacements.
What is the difference between local and global stiffness matrices?
The local stiffness matrix is derived in the element's own coordinate system, with the x-axis running along the element's length. The global stiffness matrix is the same physical element but expressed in the structure's global coordinate system (a fixed x-y frame). For horizontal elements the two are identical. For inclined elements you apply the transformation K_global = T^T * K_local * T using the rotation matrix T built from the inclination angle. Only global-coordinate element matrices can be directly added together into the structure stiffness matrix.
How do I assemble the global structure stiffness matrix from element matrices?
Each element has a global DOF map that relates its local DOF indices to the global DOF numbering of the full structure. For each element, you loop over its DOF pairs (i,j) and add K_global[i,j] of that element to K_structure[global_i, global_j]. Shared DOFs (nodes shared between two or more elements) accumulate contributions from all elements connected at that node. After assembly, you apply boundary conditions and solve the reduced system.
Does this calculator handle Timoshenko (shear-deformable) beams?
No - this calculator uses the classical Euler-Bernoulli (Kirchhoff) beam formulation, which is accurate for slender beams where the span-to-depth ratio is 5 or greater. Timoshenko beam theory includes additional terms related to shear deformation and is needed for short, deep beams or sandwich panels. The coefficients differ from the Euler-Bernoulli values computed here.