Answer To: See two files. Need by 7am (Central time) on March 28th in formats listed in assignment.
Kshitij answered on Apr 01 2021
Problem 2.zip
Problem 2/BeamAssemble.m
function y = BeamAssemble(K,k,i,j)
%This function assembles the element stiffness
% matrix k of the beam element with nodes
% i and j into the global stiffness matrix K.
% This function returns the global stiffness matrix K
% after the element stiffness matrix k is assembled.
K(2*i-1,2*i-1) = K(2*i-1,2*i-1) + k(1,1) ;
K(2*i-1,2*i) = K(2*i-1,2*i) + k(1,2) ;
K(2*i-1,2*j-1) = K(2*i-1,2*j-1) + k(1,3) ;
K(2*i-1,2*j) = K(2*i-1,2*j) + k(1,4) ;
K(2*i,2*i-1) = K(2*i,2*i-1) + k(2,1) ;
K(2*i,2*i) = K(2*i,2*i) + k(2,2) ;
K(2*i,2*j-1) = K(2*i,2*j-1) + k(2,3) ;
K(2*i,2*j) = K(2*i,2*j) + k(2,4) ;
K(2*j-1,2*i-1) = K(2*j-1,2*i-1) + k(3,1) ;
K(2*j-1,2*i) = K(2*j-1,2*i) + k(3,2) ;
K(2*j-1,2*j-1) = K(2*j-1,2*j-1) + k(3,3) ;
K(2*j-1,2*j) = K(2*j-1,2*j) + k(3,4) ;
K(2*j,2*i-1) = K(2*j,2*i-1) + k(4,1) ;
K(2*j,2*i) = K(2*j,2*i) + k(4,2) ;
K(2*j,2*j-1) = K(2*j,2*j-1) + k(4,3) ;
K(2*j,2*j) = K(2*j,2*j) + k(4,4) ;
y=K;
Problem 2/BeamElementForces.m
function y = BeamElementForces(k,u)
%This function returns the element nodal force
% vector given the element stiffness matrix k
% and the element nodal displacement vector u.
y=k*u;
Problem 2/BeamElementStiffness.m
function y = BeamElementStiffness(E,I,L)
%BeamElementStiffness This function returns the element
% stiffness matrix for a beam
% element with modulus of elasticity E,
% moment of inertia I, and length L.
% The size of the element stiffness matrix is 4x4.
y = E*I/(L*L*L) * [12 6*L -12 6*L ; 6*L 4*L*L -6*L 2*L*L ; -12 -6*L 12 -6*L ; 6*L 2*L*L -6*L 4*L*L];
Problem 2/Data_Input_Output_Table.xlsx
Input_Data
Number of nodes in the slab 6
# Element Node Element length L, ft Height of the slab section in element, in Modulus of the elasticity for the element material, psi Density of the element material, lb/ft^3
i j
1 1 2 5 8 4.50E+06 145
2 2 3 5 6 4.50E+06 145
3 3 4 5 4 4.50E+06 145
4 4 5 5 6 4.50E+06 145
5 5 6 5 8 4.50E+06 145
Problem 2/Problem_2.m
% Length of each element (in):
L_1=xlsread('Data_Input_Output_Table.xlsx','Input_Data','D5')*12;
L_2=xlsread('Data_Input_Output_Table.xlsx','Input_Data','D6')*12;
L_3=xlsread('Data_Input_Output_Table.xlsx','Input_Data','D7')*12;
L_4=xlsread('Data_Input_Output_Table.xlsx','Input_Data','D8')*12;
L_5=xlsread('Data_Input_Output_Table.xlsx','Input_Data','D9')*12;
%Height of the slab section in each element, in
H_1=xlsread('Data_Input_Output_Table.xlsx','Input_Data','E5');
H_2=xlsread('Data_Input_Output_Table.xlsx','Input_Data','E6');
H_3=xlsread('Data_Input_Output_Table.xlsx','Input_Data','E7');
H_4=xlsread('Data_Input_Output_Table.xlsx','Input_Data','E8');
H_5=xlsread('Data_Input_Output_Table.xlsx','Input_Data','E9');
% Modulus of the elasticity for material of each element (psi)
E_1=xlsread('Data_Input_Output_Table.xlsx','Input_Data','F5');
E_2=xlsread('Data_Input_Output_Table.xlsx','Input_Data','F6');
E_3=xlsread('Data_Input_Output_Table.xlsx','Input_Data','F7');
E_4=xlsread('Data_Input_Output_Table.xlsx','Input_Data','F8');
E_5=xlsread('Data_Input_Output_Table.xlsx','Input_Data','F9');
% Unit width of the slab in Z direction
UW=12;
%The second-area moment of the beam section of each element about the Z axis, in^4:
J_Z_1=Rectangular_Area_Moment(UW,H_1);
J_Z_2=Rectangular_Area_Moment(UW,H_2);
J_Z_3=Rectangular_Area_Moment(UW,H_3);
J_Z_4=Rectangular_Area_Moment(UW,H_4);
J_Z_5=Rectangular_Area_Moment(UW,H_5);
%Stiffness matrices for each element:
Km_1=BeamElementStiffness(E_1,J_Z_1,L_1);
Km_2=BeamElementStiffness(E_2,J_Z_2,L_2);
Km_3=BeamElementStiffness(E_3,J_Z_3,L_3);
Km_4=BeamElementStiffness(E_4,J_Z_4,L_4);
Km_5=BeamElementStiffness(E_5,J_Z_5,L_5);
% Global Stiffness Matrix
GM=zeros(2*(xlsread('Data_Input_Output_Table.xlsx','Input_Data','D1')),2*(xlsread('Data_Input_Output_Table.xlsx','Input_Data','D1')));
GM=BeamAssemble(GM,Km_1,xlsread('Data_Input_Output_Table.xlsx','Input_Data','B5'),xlsread('Data_Input_Output_Table.xlsx','Input_Data','C5'));
GM=BeamAssemble(GM,Km_2,xlsread('Data_Input_Output_Table.xlsx','Input_Data','B6'),xlsread('Data_Input_Output_Table.xlsx','Input_Data','C6'));
GM=BeamAssemble(GM,Km_3,xlsread('Data_Input_Output_Table.xlsx','Input_Data','B7'),xlsread('Data_Input_Output_Table.xlsx','Input_Data','C7'));
GM=BeamAssemble(GM,Km_4,xlsread('Data_Input_Output_Table.xlsx','Input_Data','B8'),xlsread('Data_Input_Output_Table.xlsx','Input_Data','C8'));
GM=BeamAssemble(GM,Km_5,xlsread('Data_Input_Output_Table.xlsx','Input_Data','B9'),xlsread('Data_Input_Output_Table.xlsx','Input_Data','C9'));
%GM(1,1) GM(1,2) GM(1,3) GM(1,4) GM(1,5) GM(1,6) GM(1,7) GM(1,8) GM(1,9) GM(1,10) GM(1,11) GM(1,12) U_1_y F_1_y
%GM(2,1) GM(2,2) GM(2,3) GM(2,4) GM(2,5) GM(2,6) GM(2,7) GM(2,8) GM(2,9) GM(2,10) GM(2,11) GM(2,12) Phi_1 M_1
%GM(3,1) GM(3,2) GM(3,3) GM(3,4) GM(3,5) GM(3,6) GM(3,7) GM(3,8) GM(3,9) GM(3,10) GM(3,11) GM(3,12) U_2_y F_2_y
%GM(4,1) GM(4,2) GM(4,3) GM(4,4) GM(4,5) GM(4,6) GM(4,7) GM(4,8) GM(4,9) GM(4,10) GM(4,11) GM(4,12) x Phi_2 = M_2
%GM(5,1) GM(5,2) GM(5,3) GM(5,4) GM(5,5) GM(5,6) GM(5,7) GM(5,8) GM(5,9) GM(5,10) GM(5,11) GM(5,12) U_3_y F_3_y
%GM(6,1) GM(6,2) GM(6,3) GM(6,4) GM(6,5) GM(6,6) GM(6,7) GM(6,8) GM(6,9) GM(6,10) ...