Adding matrices (to assemble global stiffness matrix)
Afficher commentaires plus anciens
I want to add several 4X4 matrices into one large one, see code below on method. This is to assemble a global stiffness matrix of several bar elements. I will have 3 matrices to add into 1 large one, but I am stuck in modifying the code to add 3 4x4 matrices into one 6x6.
A simple example:
C = {[1,1;1,1],[1,1;1,1]}; % <- all matrices
N = numel(C);
M = zeros(1+N,1+N);
for k = 1:N, M(k:k+1,k:k+1) = M(k:k+1,k:k+1)+C{k}; end
M
M =
1 1 0
1 2 1
0 1 1
1 commentaire
David Hill
le 22 Nov 2021
You will have to explain more fully what you want to do. Adding 3 4x4 matrices (total elements=48) into 6x6 matrix (total elements= 36), how are you suppose to do that? Where is the overlap between matrices?
Réponse acceptée
Plus de réponses (0)
Catégories
En savoir plus sur Matrix Indexing dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!