How to do 2d and 3d truss analyis with solve & createpde function in Matlab?
2 次查看(过去 30 天)
显示 更早的评论
Hi
There are many examples about structural analysis in documentation but I can't find any example about trusses.
How I can analyze a 2d or 3d trusses (added mass at each node) with solve & createpde function in Matlab?
It can be useful more problems such as truss optimizations with natural frequency constraint.
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/337369/image.png)
1 个评论
Asad (Mehrzad) Khoddam
2020-9-1
The PDE toolbox of Matlab can solve continous problems. The truss problems are descrete problems. The mass of each bar can be lumped into the joints and the natural frequencey (the first mode) can be foud by soliving the dynamics equations of equilibrium. I have a program in Matlab that calculates K matrix. In the future I will add calculations for M matrix to it
回答(1 个)
Rita Akonobi
2020-10-22
Hi, I am currently working on truss optimization with frequency constraints. I can explain to you how I did mine and hopefully it will help
1. Compute K matrix (Global stiffness matrix)
2, Compute M matrix (Global mass matrix)
3. Use "eig" functionin MATLAB to find the eigen values
4. The natural frequency is the sqrt of the eigen value(s) in 3
See my codes below according t the numbering above
% Computes the stiffness matrix for 2-noded truss elements with
% linear elastic law
%
function [ke] = stiffTRUSS2D(csarea,elength,ecos,esin,young)
%
%
% Assemble element stiffness matrix
%
ke=young*csarea/elength*[ ecos*ecos ecos*esin -ecos*ecos -ecos*esin ;...
ecos*esin esin*esin -ecos*esin -esin*esin ;...
-ecos*ecos -ecos*esin ecos*ecos ecos*esin ;...
-ecos*esin -esin*esin ecos*esin esin*esin ];
end
function [me] = element_mass_matrix(density,csarea,elength)
% solve individual element mass matrix
me = (density*csarea*elength/6)*[2 0 1 0;0 2 0 1;1 0 2 0;0 1 0 2];
%me = (density*csarea*elength/2)*[1 0 0 0;0 1 0 0;0 0 1 0;0 0 0 1];
end
% Compute global stiffness and assemble system of equations
%
K = zeros(npoin*ndofn,npoin*ndofn);
for ielem = 1:nelem
%...compute element stiffness
ke = stiffTRUSS2D(csarea(ielem),elength(ielem),ecos(ielem),esin(ielem),matprop.young);
%...add element contribution to global stiffness
gpos = eldofs(ielem,:);
K(gpos,gpos) = K(gpos,gpos) + ke;
end
% Compute global mass matrix
M = zeros(npoin*ndofn,npoin*ndofn);
for ielem =1:nelem
%compute individual element mass matrix
me = element_mass_matrix(matprop.density,csarea(ielem),elength(ielem));
%...add element contribution to global mass matrix
gpos = eldofs(ielem,:);
M(gpos,gpos) = M(gpos,gpos) + me;
end%form a system of matrix for mass matrix & K-stiffness matrix
K_M =(K) *inv (M);
%Compute natural frequency
[V,D] =eig(K_M);
eig_vec = V;
nfreq = sqrt(D);
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Structural Analysis 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!