File Exchange

image thumbnail

Fast Global Stiffness Matrix Assembly

version 1.0.1 (1.21 KB) by Ayad Al-Rumaithi
Generates global stiffness matrix from elements stiffness matrices in a fast way


Updated 04 Apr 2020

View Version History

View License

function K=Fast_Matrix_Assembly(Elements)

Elements: a structure contains Elements{i}.K and Elements{i}.DOFs (Stiffness and Degrees of freedoms of the ith element).

K: Sparse global stiffness matrix

Cuvelier, François, Caroline Japhet, and Gilles Scarella. "An efficient way to perform the assembly of finite element matrices in Matlab and Octave." arXiv preprint arXiv:1305.3122 (2013).

Cite As

Ayad Al-Rumaithi (2021). Fast Global Stiffness Matrix Assembly (, MATLAB Central File Exchange. Retrieved .

Comments and Ratings (11)

sina Jhian Azar

I am trying to assemble global stiffness matrix for CST element I want to ask if this file is useful for it plus, I don't understand how to use this m.file for my codes please help me

Ayad Al-Rumaithi

It seems you didn’t add the effect of supports to the stiffness matrix. You should remove the rows and columns that corresponding to the supports degree of freedom

Shubham Sharma

I tried this code but I always get the warning 'Matrix is singular to working precision'. I am unable to find where am I going wrong. Can you please give any suggestions?

Marius Mellmann

Ayad Al-Rumaithi

Dear Anilcan Taner,
Elements{i}.K should be the stiffness matrix of ith element .Elements{i}.DOFs degrees of freedom vector of the ith element.
in your example it could be:
Elements{1}.DOFs=[5 1 6];
Elements{2}.DOFs=[6 1 2];


I am having problem with inputs for example;

i have 3x3 matrices named as KK{i} which i=1:9

but I am a bit lost with putting it to the code

Mathew Da Silva

Are you able to give an example of an input? I am trying to run this for a 3D frame model. Thanks in advance

Ayad Al-Rumaithi

Yes. It can be used with any type of elements

Nuttibase Charupeng

can this be used for 3-D elements?

Ayad Al-Rumaithi

Thank you

Nuttibase Charupeng

Very useful. Very fast

MATLAB Release Compatibility
Created with R2017b
Compatible with any release
Platform Compatibility
Windows macOS Linux

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!