FEM-Course-Matlab/10.四节点八节点四边形单元悬臂梁的Matlab有限元编程/4_nodes/ele_stiff_matrix.m

27 lines
1.2 KiB
Matlab
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

function ke=ele_stiff_matrix(E_ID,Nodes,Elements,E,u,Width)
ENodes(:,1) = Elements(E_ID,:);
iN = size(ENodes,1);
ke = zeros(2*iN,2*iN);
D=[E/(1-u^2),u*E/(1-u^2),0;
u*E/(1-u^2),E/(1-u^2),0;
0,0,E/(2*(1+u))];
% 计算高斯积分点坐标
kesi_yita=[-1/sqrt(3),-1/sqrt(3);1/sqrt(3),-1/sqrt(3);1/sqrt(3),1/sqrt(3);-1/sqrt(3),1/sqrt(3)];
w=[1,1];ww=[w(1)*w(1),w(2)*w(1),w(1)*w(1),w(1)*w(2)];
% 高斯积分计算单元刚度矩阵
for i=1:4
kesi=kesi_yita(i,1);yita=kesi_yita(i,2); %鎻愬彇褰㈠嚱鏁板<E98F81>kesi锛堟垨yita锛夌殑鍋忓<E98D8B>鍊?
J = Jacobi(E_ID,kesi,yita,Elements,Nodes); % 雅可比矩阵
% J=Q4_J(kesi,yita,xy); %璁畻J鐭╅樀
A=1/det(J)*[ J(2,2),-J(1,2), 0, 0;
0, 0,-J(2,1), J(1,1);
-J(2,1), J(1,1), J(2,2),-J(1,2)]; %鏍规嵁J鐭╅樀璁畻A鐭╅樀
G=Q4_G(kesi,yita); %鏍规嵁鍋忓<E98D8B>鍊艰<E98D8A>绠桮鐭╅樀
B=A*G; %鏍规嵁A鍜孏璁畻搴斿彉鐭╅樀B锛堥珮鏂<E78FAE>Н鍒嗙偣澶勭殑搴斿彉鐭╅樀B锛?
ke=ke+ww(i)*B'*D*B*Width*det(J);
end
end