How to do 2d and 3d truss analyis with solve & createpde function in Matlab?

12 views (last 30 days)
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.
  1 Comment
Asad (Mehrzad) Khoddam
Asad (Mehrzad) Khoddam on 1 Sep 2020
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

Sign in to comment.

Answers (1)

Rita Akonobi
Rita Akonobi on 22 Oct 2020
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);

Products


Release

R2019b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!