This paper presents a unified MATLAB®-based solver for the linear static analysis of two-dimensional structural systems, including trusses, beams, and frames, using the Direct Stiffness Method. The implementation formulates element stiffness matrices in local coordinates and applies systematic coordinate transformations to assemble the global stiffness matrix while enforcing equilibrium and compatibility conditions. The solver supports both truss analysis, considering axial deformation only, and beam/frame analysis, incorporating axial, bending, and rotational degrees of freedom. Concentrated joint loads and uniformly distributed member loads are accommodated, with distributed loads automatically converted into equivalent nodal forces. Boundary conditions representing fixed, pinned, and roller supports are applied through matrix partitioning. In addition to computing global joint displacements and support reactions, the solver evaluates internal axial member forces for truss elements. The code is designed with a modular structure to promote clarity, extensibility, and reproducibility, making it suitable for educational use, verification studies, and preliminary structural analysis. The paper includes three illustrative applications (a beam, a frame, and a truss) to demonstrate the formulation, usage, and accuracy of the solver. The associated MATLAB source code is released as open-source to support transparent verification and further development.
Mohamad Alaaeddine (Mon,) studied this question.