Stitching together matrices/ indexing matrices

Hi there any help would be appreciated...
I am a mech engineer working with rotor dynamics and am being asked to do FEA on matlab. I have the following formula for the stiffness matrix for each element: K = ( E * A / Le) * [1 -1; -1 1]. What I would like to is compute the values of these matricies for 4 elements, the soln should be 4 K matricies... and my question regarding this is how do I index these 2x2 K matricies to be K1, K2, K3, K4? When I try to do this using a For Loop, I code the following:
%noel is number of elements which is 4
for i = 1: noel
K{i} = ( E * A / Le) * [1 -1; -1 1];
end
-doing this I get an error saying theres an issue with usijng { }, I have tried [] and () and had no luck either.
(I understand it says ask one question per post but I want to include my second one for a little more context to the overall problem)
The next step I need to do is to stitch the matricies together diagonally. What I mean by this is if you consider the 2x2 to be [A B;C D] for each K value, I need to produce one final matrix consisting of adding the first and last elements of each K matrix together. EX: if K1 = [A B; C D] and K2 = [E F; G H] I want to merge them such as K_system = [A B 0; C (d+E) F; 0 G H]. I need to do this for K1-4.
Sorry for the multiple question post, do not feel obliged to answer both, I can post them separately. The dual question is for sake of context.
Thanks,
Kyle

2 件のコメント

Asad (Mehrzad) Khoddam
Asad (Mehrzad) Khoddam 2020 年 10 月 15 日
In FEM, you need to fine local stiffness matrix then assemble it to the global stiffness matrix.
The location of each k_ij in K depends on the location of members and connection between them
Kyle McLaughlin
Kyle McLaughlin 2020 年 10 月 15 日
Right, this question is about assembling them into the global matrix, the K matrix is the same for all elements as described above. The problem statement is specifically regarding modeling a free-free beam in axial vibration and that was the equation my prof gave in the slides for "pure axial vibration". I am unaware of how to index these individual K values for the purpose of assembly, in addition to the assembly process of the first and last elements. The logic I imagined to follow was to 1) index K values 2) add the last and first elements of adjacent arrays 3) assemble global matrix 4) repeat for mass matrix 5) perform eig()....

サインインしてコメントする。

回答 (1 件)

Asad (Mehrzad) Khoddam
Asad (Mehrzad) Khoddam 2020 年 10 月 15 日

1 投票

For each k, you should know the connectivity array, for example if the first element is connected to the following degrees of freedom:
cArray=[1, 2, 5, 6]
Then
K(cArray, cArray) = K(cArray, cArray) + k;
Where k is the local stiffness matrix

6 件のコメント

Kyle McLaughlin
Kyle McLaughlin 2020 年 10 月 15 日
I dont understant, are you saying that I am missing some form of matrix needed to complete this calculation? We did not talk about the requirement of any sort of "connectivity array" in lecture. The problem statement provides 4 elements and nodes = dof = 5
Kyle McLaughlin
Kyle McLaughlin 2020 年 10 月 15 日
My understanding of the question is that I have the 2x2 K matrix (defined in the inital question) which represents the stiffness of each element in the free free beam and that I need to stitch together 4 of those
Asad (Mehrzad) Khoddam
Asad (Mehrzad) Khoddam 2020 年 10 月 16 日
So the connectivity array of the first element is:
% element 1
%[1, 2, 3, 4]
% element 2
%[3, 4, 5, 6]
% element 3
%[5, 6 , 7, 8]
% and element 4:
%[7, 8, 9, 10]
cArray = [1:4];
K(cArray, cArray) = K(cArray, cArray) + k;
cArray = [3:6];
K(cArray, cArray) = K(cArray, cArray) + k;
cArray = [5:8];
K(cArray, cArray) = K(cArray, cArray) + k;
cArray = [7:10];
K(cArray, cArray) = K(cArray, cArray) + k;
Kyle McLaughlin
Kyle McLaughlin 2020 年 10 月 16 日
編集済み: Kyle McLaughlin 2020 年 10 月 16 日
Thank you for your detailed response, I am still unaware however of what the connectivity array is used for and how it is incoroporated into the calculations. We never discussed this in lecture. What would I do with this code
Asad (Mehrzad) Khoddam
Asad (Mehrzad) Khoddam 2020 年 10 月 16 日
You can use this instead:
K(1,1) = k(1,1);
for i=2:9
K(i,i)=k(1,1)+k(2,2);
K(i-1,i) = k(1,2);
K(i,i-1) = k(2,1);
end
K(9,10) = k(1,2);
k(10,9) = k(2,1);
K(10,10) = k(2,2);
Kyle McLaughlin
Kyle McLaughlin 2020 年 10 月 19 日
Thank you, this worked to assemble the K matrix and added the values I needed. Much appreciated!!!

サインインしてコメントする。

カテゴリ

ヘルプ センター および File ExchangeMatrices and Arrays についてさらに検索

製品

リリース

R2018a

質問済み:

2020 年 10 月 15 日

コメント済み:

2020 年 10 月 19 日

Community Treasure Hunt

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

Start Hunting!

Translated by