Clear Filters
Clear Filters

How to transform a mass matrix de dim 12*12 into 6*6 ?

4 views (last 30 days)
Hi I want to do a model of FEM of a cantilever beam divided into two element (Three node) . I have a part of program that
estimate the mass matrix of 6 node of dim (12*12) but i want to transform this matrix into dim 6*6.
Please help me.
% node# unused xyz
node=[1 0 0 0 0 0 0;
2 0 0 0 0 1 0;
3 0 0 0 0 2 0;
4 0 0 0 1 1 1];
elt=[
%node1 node2 pe ie refnode
1 2 1 1 4 0 %longerons
2 3 1 1 4 0];
% matid matType E nu rho
pe=[1 1 7.2e+10 3.0e-01 2.7e+03];
% secId SecType J i1 i2 A
ie=[1 1 5e-09 5e-09 5e-09 2e-05
2 1 5e-09 5e-09 5e-09 2e-05
3 1 5e-09 5e-09 5e-09 2e-09];
opt=[1 2 3];
% element matrix assembly
pe = pe(find(pe(:,1)==elt(1,3)),3:size(pe,2));
ie = ie(find(ie(:,1)==elt(1,4)),3:size(ie,2));
if length(pe)==3 pe=[pe 0]; end
if pe(4)==0 pe(4)=pe(1)/2/(1+pe(2)); end
x = [find(node(:,1)==elt(1,1));find(node(:,1)==elt(1,2))];
idof = [(1:6)/100+elt(1,1) (1:6)/100+elt(1,2)];
x = node(x,5:7);
l = norm(x(2,:)-x(1,:)); l2 = l^2;
% mass - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
if ~isempty([1 3]==opt(1))
m = zeros(12);
ind = [1 7]; m(ind,ind) = [1 .5;.5 1]/3 * ie(4);
ind = [4 10]; m(ind,ind) = [1 .5;.5 1]/3*ie(1);
ind = [2 6 8 12]; m(ind,ind) = ie(4) * ...
[78 11*l 27 -6.5*l; 11*l 2*l2 6.5*l -1.5*l2
27 6.5*l 78 -11*l ; -6.5*l -1.5*l2 -11*l 2*l2]/210;
ind = [3 5 9 11]; m(ind,ind) = ie(4) * ...
[78 -11*l 27 6.5*l;-11*l 2*l2 -6.5*l -1.5*l2
27 -6.5*l 78 11*l ; 6.5*l -1.5*l2 11*l 2*l2]/210;
m = (pe(3) * l) * m;
else
m = [];
end

Answers (1)

KSSV
KSSV on 22 Jun 2016
Hello.. This is purely a FEM question, how you can expect a FEM answer in MATLAB community? Any ways, it is quite a big code to go through. You may refer the following link for your reference:

Categories

Find more on Programming in Help Center and File Exchange

Tags

No tags entered yet.

Community Treasure Hunt

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

Start Hunting!