Compute local and global stiffness matrices for 2D truss, beam, and frame elements with clear DOF order, geometry checks, and unit-aware results.
Advanced options
How to use our Stiffness Matrix Calculator
- Choose Element type: 2D Truss, 2D Beam, or 2D Frame.
- Choose Geometry input mode. Use Length and angle if you already know the member orientation, or Node coordinates if you want the calculator to find length and angle from the two nodes.
- Enter Young's modulus (Pa). This must be greater than 0 for every element type.
- Enter the section properties needed for your element: Cross-sectional area (m^2) for truss and frame, and Second moment of area (m^4) for beam and frame.
- Enter geometry. In length-angle mode, fill in Element length (m) and Element angle (deg). In node coordinate mode, fill in Node 1 x-coordinate (m), Node 1 y-coordinate (m), Node 2 x-coordinate (m), and Node 2 y-coordinate (m).
- If you want cleaner output for homework or reports, open Advanced options and set Decimal places and Number format.
- Click Calculate to see Element length used, Element angle used, the DOF maps, the Local stiffness matrix, the Transformation matrix when applicable, and the Global stiffness matrix.
- Sanity-check the result: make sure Element length used is positive, the Cosine of angle and Sine of angle match the member direction, and the Validation note does not flag a unit or geometry problem.
Definitions
Element type: The structural member model used in the calculation. Truss means axial stretch only, beam means bending only, and frame means axial plus bending.
Geometry input mode: The way you define the member shape. You can enter length and angle directly, or enter two node coordinates and let the calculator find them.
Young's modulus (Pa): A material stiffness value. Larger E means the member resists deformation more strongly.
Cross-sectional area (m^2): The size of the member cross section used in axial stiffness terms.
Second moment of area (m^4): A bending property that shows how strongly the section resists bending.
DOF order: DOF means degrees of freedom, which are the displacement or rotation entries attached to each node. The listed order tells you what each matrix row and column means.
Local stiffness matrix: The element stiffness matrix written in the member's own local axes.
Transformation matrix: The matrix that rotates local quantities into global coordinates for truss and frame elements.
Global stiffness matrix: The element stiffness matrix written in the overall x-y coordinate system.
Cosine of angle / Sine of angle: Direction values based on the element angle. They help show whether the member points right, left, up, or down.
Validation note: A short message that explains important warnings, unit issues, or interpretation notes for the result.
Common mistakes and quick fixes
Mistake: Entering 0 or a negative value for Element length (m) or using identical node coordinates so the computed length is 0.
Fix: Make sure Element length used is greater than 0. In coordinate mode, change Node 2 x-coordinate (m) or Node 2 y-coordinate (m) so Node 2 is not the same point as Node 1.
Mistake: Typing a value for Young's modulus (Pa) in GPa, MPa, or ksi without converting to pascals.
Fix: Enter Young's modulus (Pa) in Pa exactly. For example, 200 GPa should be entered as 200000000000 Pa.
Mistake: Leaving Cross-sectional area (m^2) too large or too small because the original value was in mm^2 or in^2.
Fix: Convert the section size to square meters before calculating. Then check whether the size of the Local stiffness matrix entries looks reasonable for your material and length.
Mistake: Using Element angle (deg) measured from something other than the global x-axis, or expecting clockwise angles to be positive.
Fix: Enter Element angle (deg) counterclockwise from the global x-axis. Then compare Cosine of angle and Sine of angle with the member direction you expect.
Mistake: Entering Second moment of area (m^4) as a plain area value instead of a bending property.
Fix: Use the actual second moment of area for the section, in m^4. This input controls bending terms in the Local stiffness matrix and Global stiffness matrix for beam and frame elements.
Mistake: Reading the rows and columns of the matrix in the wrong displacement order.
Fix: Always read the matrix together with Local DOF order and Global DOF order so each row and column matches the correct translation or rotation.
Limitations & Key Assumptions / Boundary Conditions
- The calculator is for a single straight 2D element at a time, not a full assembled structure.
- 2D Truss uses axial behavior only. It does not include bending, shear deformation, or geometric nonlinearity.
- 2D Beam uses the local Euler-Bernoulli bending matrix only, with DOF order [v1, r1, v2, r2]. It does not include axial deformation or shear deformation.
- 2D Frame combines axial and Euler-Bernoulli bending behavior in 2D for a straight prismatic member.
- Material and section properties are assumed constant along the element length.
- Inputs must use SI units exactly as labeled: Pa, m, m^2, and m^4. Mixed units will give wrong matrix values.
- For beam and frame results, matrix entries can have mixed physical units because translation and rotation DOFs appear in the same matrix.
- The displayed numbers are rounded only for output. Very small floating-point values near zero may appear as 0 after formatting.
- In beam mode, a full in-plane coordinate transformation is not the main focus; the key result is the local bending stiffness matrix.
Methodology
Geometry used
If Geometry input mode is set to node coordinates, the calculator first finds the element length and angle from the two node points.
L = sqrt((x2 - x1)^2 + (y2 - y1)^2)
θ = atan2(y2 - y1, x2 - x1)
The displayed Element angle used is in degrees, but the trig steps use radians internally through the conversion factor below.
radians = degrees * π / 180
Element matrices by type
For a 2D truss element, the calculator uses axial stiffness only with local DOF order [u1, v1, u2, v2].
k_local = (E*A/L) * [[1,0,-1,0],[0,0,0,0],[-1,0,1,0],[0,0,0,0]]
Its global matrix is formed directly from the direction cosines c = cos(θ) and s = sin(θ).
k_global = (E*A/L) * [[c^2,c*s,-c^2,-c*s],[c*s,s^2,-c*s,-s^2],[-c^2,-c*s,c^2,c*s],[-c*s,-s^2,c*s,s^2]]
For a 2D beam element, the calculator uses the standard Euler-Bernoulli local bending matrix with local DOF order [v1, r1, v2, r2].
k_local = (E*I/L^3) * [[12,6*L,-12,6*L],[6*L,4*L^2,-6*L,2*L^2],[-12,-6*L,12,-6*L],[6*L,2*L^2,-6*L,4*L^2]]
For a 2D frame element, the calculator combines axial and bending behavior with local DOF order [u1, v1, r1, u2, v2, r2].
k_local = [[A*E/L,0,0,-A*E/L,0,0],[0,12*E*I/L^3,6*E*I/L^2,0,-12*E*I/L^3,6*E*I/L^2],[0,6*E*I/L^2,4*E*I/L,0,-6*E*I/L^2,2*E*I/L],[-A*E/L,0,0,A*E/L,0,0],[0,-12*E*I/L^3,-6*E*I/L^2,0,12*E*I/L^3,-6*E*I/L^2],[0,6*E*I/L^2,2*E*I/L,0,-6*E*I/L^2,4*E*I/L]]
The frame transformation matrix rotates local translations into global x-y directions while keeping rotations about the z-axis unchanged.
T = [[c,s,0,0,0,0],[-s,c,0,0,0,0],[0,0,1,0,0,0],[0,0,0,c,s,0],[0,0,0,-s,c,0],[0,0,0,0,0,1]]
k_global = transpose(T) * k_local * T
How to read the output
The calculator shows both the matrix and the matching DOF map so you can connect each row and column to a physical displacement or rotation. This matters because negative off-diagonal terms are often correct and come from coupling between DOFs, not from a sign error.
If the member is horizontal, local and global frame matrices may match exactly. If the member is rotated, the global matrix should change according to the direction cosines.
Mini example
Suppose you choose 2D Truss with Young's modulus (Pa) = 200000000000, Cross-sectional area (m^2) = 0.01, Element length (m) = 2, and Element angle (deg) = 30.
E*A/L = 200000000000 * 0.01 / 2 = 1000000000
c = cos(30 deg) = 0.866025...
s = sin(30 deg) = 0.5
k_global(1,1) = (E*A/L) * c^2 = 1000000000 * 0.75 = 750000000
k_global(1,2) = (E*A/L) * c*s = 1000000000 * 0.4330127... = 433012701.9
Those values match the expected top-left entries for the truss global matrix, so they are a good quick check that the angle and units were entered correctly.
Assumptions behind the math
The formulas assume a straight element, small deformations, linear elastic material behavior, and constant section properties along the element. Results can differ from a full finite element program when shear deformation, releases, distributed loads, nonlinear effects, or full structure assembly are included [1].