我正在尝试为一个简单支撑的棒组装局部矩阵(使用有限元方法)以制作整体质量和刚度矩阵,然后我想找到这些振动与元素数N的4个最低本征频率。我想找到w1,w2,w3,w4作为N的函数,元素的数量是钢筋总长度(1米)除以元素长度(取决于元素总数N),然后绘制为x值为N,y轴为频率(w)。这是一个简单的有限元问题,但我似乎无法正确地确定边界条件,并且不确定是否将局部矩阵正确地组装成全局矩阵。
我也尝试将绘图放入for循环中,但这只是重置点。这里的主要问题是为简单受支持的条(在x = 0且x = L处的位移为零(我认为是外部的行和列))确定边界条件,然后正确地组装全局矩阵。
for N = 1:10^4;
% Now compute 4 lowest eigenfrequencies
E = 60*10^9; % Young's Modulus
m = 4.259; % Mass per unit length
L= 1; % length of bar = 1 m
A = pi*R^2; % Area of the bar
%Re-writing matrices from above in answer
l = L./N;
Ke = E*A.*[1, -1;-1, 1]./L; % Stiffness matrix
Me = m.*l.*[2, 1; 1, 2]./6;
% Localization Operator: the boolean matrix for picking the nodal
% displacements qe of an element out of the global set of degrees of
% freedom q.
Le= [0 : N-1; 1 : N];
% Need to input global matrices (assembled ones from page 367 of textbook)
K = zeros(N);
M = zeros(N);
% N is not given (must be summed from e=1 to whatever N)
for e = 1:N
Struct_load_vector = Le(:,e);
Iden_matrix = (Struct_load_vector ~= 0);
Struct_load_vector = Struct_load_vector(Iden_matrix);
K(Struct_load_vector, Struct_load_vector) = K(Struct_load_vector, Struct_load_vector) + Ke(Iden_matrix, Iden_matrix);
M(Struct_load_vector, Struct_load_vector) = M(Struct_load_vector, Struct_load_vector) + Me(Iden_matrix, Iden_matrix);
end
squared_freq=eig(K,M);
frequency = sqrt(squared_freq(1))
end