File Exchange

image thumbnail

Mass and Stiffness Matrix Extractor from Sap 2000

version 1.0.1 (2.02 KB) by Ahmed Anas
This program can be used to extract mass and stiffness matrices for your Sap 2000 analysis problem.


Updated 08 Mar 2020

View License

Stiffness and Mass matrix plays a very important role in structural static and dynamic analysis problem. The entire analysis problem is based on these two matrices. But Sap 2000 does not provide these matrices directly, thus some indirect method has to be used to get these matrices and have some better understanding. Accordingly, this program has been developed to extract stiffness and mass matrices for your particular problem case from Sap 2000.
Instructions about using this program have been described in the m file.

Cite As

Ahmed Anas (2020). Mass and Stiffness Matrix Extractor from Sap 2000 (, MATLAB Central File Exchange. Retrieved .

Comments and Ratings (4)

Ahmed Anas

Ihsan Engin Bal, Yeah there are zero elements in the diagonal in the mass matrix, because saps assign zero mass to the rotation DOF (have tested for 2D frames) so better option is to exclude these rows,columns and then inverse can be computed. As far as your second question is considered, have not considered the effect of constraints yet in my function. But i'll try to cover all these in the next version. Thanks..

Ahmed, I worked a bit more on the code. The answer to my first question is: The mass matrix from SAP2000 has some zero elements along the diagonal (depending on the active DOFs in the model). In this case the inverse is not possible obviously. I assigned very small non-zero values on the zero elements along the diagonal and the problem was solved. I also calculated the eigenvalues by using the K and M matrices from your cod, for a rather complex structure with shell elements. They do match, so it works.

My question for the constraints still stands but it is more of a theoretical question in fact. You may consider this in the next version(s).



Hello Ahmed. It is a very useful code, thanks. I have two questions:

1. I get the following warning even for the simplest structures and its mass matrix:
Warning: Matrix is singular to working precision.

2. What happens if there are constraints in the model (i.e. there is also a TXC file)?


Tan Nguyen


Could you introduce us the theory, particularly equations, used to build the matrices in SAP?

Best Regards,



Can be used for 2d and 3d problems.

MATLAB Release Compatibility
Created with R2019b
Compatible with R2017a to R2019b
Platform Compatibility
Windows macOS Linux