The combination of a large stiffness matrix from several small

This is a trivial problem, but I am just starting out with Matlab and am not yet used to their way of thinking (and the syntax).

What I ask for will be obvious to anyone who has ever done anything with FEM or the like.

How did you assemble a large stiffness matrix from several small ones. Let's say you have (element 1) a local 4x4 stiffness matrix, the same for (element 2) - a different matrix, of course, but still 4x4.

What is the easiest way to do this:

[|--------| 0  0 ]  
[|        | 0  0 ]  
[|     |--|-----|]  
[|-----|--|     |]  
[0  0  |        |]  
[0  0  |--------|]  

(a33+b11, a34+b12,
(a43+b12, a44+b22, ...)

i.e. make "big"?

+3
source share
3 answers

I think your question is this:

A = 4x4 B = 4x4

C = finite matrix, where A and B overlap and must be summed in the overlap.

:

C = zeros(6);
C(1:4,1:4) = A;
C(3:6,3:6) = C(3:6,3:6) + B;
+5

. . , . . , Matlab. .

, , , . . , . Sparse , .

, , . , 1e5x1e5 .

, .

+6

Just for fun, here is a single line solution using BLKDIAG :

C = blkdiag(A,zeros(2)) + blkdiag(zeros(2),B);
+5
source

Source: https://habr.com/ru/post/1709625/


All Articles