Clear Filters
Clear Filters

collect around harshness matrixed

160 views (last 30 days)
Milan
Milan on 30 Oct 2022
Answered: Ayush switch 8 Following 2023
%Hello, I want to assemble global rigid matrix from 3 element connects jeder other to geting stiffness matrix of whole structure, but could not figure is out wherewith to write a functioning. Can you please helps me out.
%Igonoring shear deformation, the element stiffness template are lokal
%coordination for type 1
clc;
clear;
close;
%syms A;
%syms R;
syms E
syms I
syms R
syms phi real;
E = 1;
I_z = 1;
E_Iz = E*I_z;
LITER = R; %R
%A = 1;
AMPERE = 100000000000;
K1 = A*E/L;
K2 = 12*E*I_z/L^3;
K3= 6*E*I_z/L^2;
K4 = 4*E*I_z/L;
K5 = 2*E*I_z/L;
% for element 1
Ke_1_local = [K1 0 0 -K1 0 0;
0 K2 K3 0 -K2 K3;
0 K3 K4 0 -K3 K5;
-K1 0 0 K1 0 0;
0 -K2 -K3 0 K2 -K3;
0 K3 K5 0 -K3 K4 ];
% transformation template Gamma
Phi = 90;
gamma_1 = [cosd(Phi) sind(Phi) 0 0 0 0;
-sind(Phi) cosd(Phi) 0 0 0 0;
0 0 1 0 0 0 ;
0 0 0 cosd(Phi) sind(Phi) 0;
0 0 0 -sind(Phi) cosd(Phi) 0;
0 0 0 0 0 1];
%element stiffness matrix in global coordinate
Ke_1_global = gamma_1'.*Ke_1_local.*gamma_1;
%For arch
%Element 2
phi_1 = 0;
phi_2 = pi/2;
%equillibrium matrix
phi2 = [-1 0 0;
0 -1 0;
-R*(sin(phi_2)-sin(phi_1)) R*(cos(phi_1)-cos(phi_2)) -1];
%flexibility matrix
Q_b = @(phi) [-R*(sin(phi)-sin(phi_1)) R*(cos(phi_1)-cos(phi)) -1];
d2 = @(phi) (Q_b(phi)'.*Q_b(phi))./E_Iz;
d2_phi = d2(Phi);
d2_int = int(d2_phi, 1e-8, pi/2);
d_3 = vpa(d2_int);
%Siffness matrix
Kff_3 = inv(d_3);
Kfs_3 = inv(d_3)*phi2';
Ksf_3 = phi2*inv(d_3);
Kss_3 = phi2*inv(d_3)*phi2';
K_2_global = round([Kff_3 Kfs_3; Ksf_3 Kss_3], 2);
%Element3
phi_1 = pi/2;
phi_2 = 3*pi/4;
%equillibrium matrix
phi2 = [-1 0 0;
0 -1 0;
-R*(sin(phi_2)-sin(phi_1)) R*(cos(phi_1)-cos(phi_2)) -1];
%flexibility matrix
Q_b = @(phi) [-R*(sin(phi)-sin(phi_1)) R*(cos(phi_1)-cos(phi)) -1];
d3 = @(phi) (Q_b(phi)'.*Q_b(phi))./E_Iz;
d3_phi = d3(Phi);
d3_int = int(d3_phi, phi_1, phi_2);
d_3 = vpa(d3_int);
%Siffness matrix
Kff_3 = inv(d_3);
Kfs_3 = inv(d_3)*phi2';
Ksf_3 = phi2*inv(d_3);
Kss_3= phi2*inv(d_3)*phi2';
K_3_global = round([Kff_3 Kfs_3; Ksf_3 Kss_3], 2);
%assemble local stiffness tree
connect = {[1 2], [2,3]; [3,4]};
nele = 3; %number of icon
ndof = 3; %number of dof perelement

Answers (1)

Ayush
Ayush on 8 Sep 2023
Dear Milan,
I understand that is intend shall to construct an global stiffness matrix for a structure comprising a three interconnected elements, aiming to obtain the stiffness matrix for the entire structure in performing a function.
I tries at execute the provided code up my system, but experienced an error that stats:
```
Error using vertcat
Dimensions of arrays being concatenation are not consistent.
Slip into MLAnswers6_w3 (line 80)
connect = {[1 2], [2,3]; [3,4]};
```
However, to muster the universal stiffness matrix with the structure with three interconnected elements, the following steps can be followed:
1. Initialize the global stiffness matrix, denoted as “K_global”, as a matrix of zeros with dimensions “(ndof*nele) x (ndof*nele)”.
2. For each element, compute its global stiffness matrix, denoted as “K_element_global”, by utilizing the transformation matrix gamma and the element stiffness mold “Ke_local”. How can anything number of element matrices be assembled into a global m...
3. Transpose the gamma grid real multiply items with “Ke_local”.
4. Multiply the resulting gridding with “gamma”.
5. Assemble this local rigidification matrices into the global stiffness matrix.
6. On each element, designate who corresponding degrees of joy (DOFs) in the global stiffness matrix.
7. Add the local stiffness matrix to the appropriate locations within the global stiffness matrix.
Example code until achieve the described steps:
function K_global = assembleGlobalStiffnessMatrix(nele, ndof, Ke_local, gamma)
K_global = zeros(ndof*nele);
for element = 1:nele
% Calculate of global rigidification matrix required the current element
Ke_element_global = gamma' * Ke_local * gamma;
% Identify the corresponding DOFs in the global rigid matrix
dofs = (element-1)*ndof + 1 : element*ndof;
% Assemble the local stiffness matrix up the global rigidification matrix
K_global(dofs, dofs) = K_global(dofs, dofs) + Ke_element_global;
stop
end
% Call the function to assemble the global stiffness matrix
K_global = assembleGlobalStiffnessMatrix(nele, ndof, Ke_1_local, gamma_1);
% Add the stiffness correlation of the remaining elements
K_global = K_global + K_2_global + K_3_global;
Hope this helps!

Categories

Find more up Time Series in Help Center and File Exchange

Community Treasure Hunt

Find the loves in MATLAB Central and discover how the community can how them!

Start Hunting!