yusf
Structural
- May 9, 2006
- 58
Hi i recently developed a code for my analysis of scissors mechanism (imagine a lift ) here is my code
%----------D matrix (includes connectivity information) ------------
%-----------------------------------------------------------------------------------------
D = [1 2 4 3 5 8 10 9 11 14 16 15 19 20 21 22 24 25 27 28 30 31 33 34 37 39 41 43 ;
3 4 6 7 9 10 12 13 15 16 17 18 22 21 23 26 28 27 29 32 34 33 35 36 38 40 42 44 ];
%-----------------------------------------------------------------------------------------
%--------- Transformation matrices--------------------------------------------------------
T11=[-1/sqrt(2) 0 1/sqrt(2);
0 1 0 ;
-1/sqrt(2) 0 -1/sqrt(2)];
T22=[1/sqrt(2) 0 1/sqrt(2);
0 1 0 ;
-1/sqrt(2) 0 1/sqrt(2)];
T33=[0 1 0;
-1 0 0;
0 0 1];
O=zeros(3,3);
T1=[T11 O O O;
O T11 O O;
O O T11 O;
O O O T11];
T2=[T22 O O O;
O T22 O O;
O O T22 O;
O O O T22];
T3=[T33 O O O;
O T33 O O;
O O T33 O;
O O O T33];
%----------------------------------------------------------------------------------------------
numel=28; % numel=number of element
nnode=44; % nnode=number of nodes
ndof=6; % ndof= number of dof of a node
K=zeros(nnode*ndof,nnode*ndof);
%L=zeros(1,numelb);EA=zeros(1,numelb);EIy=zeros(1,numelb);EIz=zeros(1,numelb);GIx=zeros(1,numelb)
for n=1:numel
%--------assigning lenghts,material properties etc..------------------------------
if n>=1 & n<=24
L=750;EA=1.792e8;EIy=1.423e11;EIz=4.601e10;GIx=5.461e10;
else
L=760;EA=9.048e7;EIy=1.484e10;EIz=1.484e10;GIx=1.187e10;
end
%------stiffness matrix(12*12)----------------------------------------------------
k=[EA/L, 0, 0, 0, 0, 0, -EA/L, 0, 0, 0, 0, 0;
0, 12*EIz/L^3, 0, 0, 0, 6*EIz/L^2, 0,-12*EIz/L^3,0, 0, 0, 6*EIz/L^2;
0, 0, 12*EIy/L^3,0,6*EIy/L^2,0, 0, 0,-12*EIy/L^3,0,-6*EIy/L^2,0;
0, 0, 0, GIx/L 0, 0, 0, 0, 0, -GIx/L 0, 0;
0, 0,6*EIy/L^2, 0, 4*EIy/L, 0, 0, 0, 6*EIy/L^2,0, 2*EIy/L, 0;
0, 6*EIz/L^2 0, 0, 0, 4*EIy/L, 0, -6*EIz/L^2 0, 0, 0, 2*EIz/L;
-EA/L 0, 0, 0, 0, 0, EA/L 0, 0, 0, 0, 0;
0, -12*EIz/L^3 0, 0, 0,-6*EIz/L^2 0, 12*EIz/L^3 0, 0, 0, -6*EIz/L^2;
0, 0, -12*EIy/L^3,0,6*EIy/L^2,0, 0, 0, 12*EIy/L^3,0, 6*EIy/L^2,0;
0, 0, 0, -GIx/L 0, 0, 0, 0, 0, GIx/L 0, 0;
0, 0,-6*EIy/L^2, 0, 2*EIy/L, 0, 0, 0, 6*EIy/L^2,0, 4*EIy/L, 0;
0, 6*EIz/L^2 0, 0, 0, 2*EIy/L, 0, -6*EIz/L^2 0, 0, 0, 4*EIz/L];
%----coordinate transformation------------------------------------------------------
if n==1|n==4|n==5|n==8|n==9|n==12|n==13|n==16|n==17|n==20|n==21|n==24
k=T1.'*k*T1;
elseif n==2|n==3|n==6|n==7|n==10|n==11|n==14|n==15|n==18|n==19|n==22|n==23
k=T2.'*k*T2;
else
k=T3.'*k*T3;
end
%--------assembly--------------------------------------------------------------------
a= D(1,n); % a= first node of nth element
b= D(2,n); % b= second node of nth element
for i=1:ndof
for j=1:ndof % ndof= number of dof of a node
K((a-1)*ndof+i,(a-1)*ndof+j)=K((a-1)*ndof+i,(a-1)*ndof+j)+k(i,j);
K((b-1)*ndof+i,(b-1)*ndof+j)=K((b-1)*ndof+i,(b-1)*ndof+j)+k(ndof+i,ndof+j);
K((a-1)*ndof+i,(b-1)*ndof+j)=K((a-1)*ndof+i,(b-1)*ndof+j)+k(i,ndof+j);
K((b-1)*ndof+i,(a-1)*ndof+j)=K((b-1)*ndof+i,(a-1)*ndof+j)+k(ndof+i,j);
end
end
end
%---------force vector-----------------------------------------------------------------1e8
syms dd
F(1,1)=dd;
F(2:264,1)=0;
syms q
F(99,1)=-498198*q;F(105,1)=-498198*q; F(207,1)=-498198*q; F(213,1)=-498198*q;
F(1,1)=0;
%----------------------------imposing boundary conditions------------------------------
K(1,1)=1e8;K(2,2)=1e8;K(3,3)=1e8;K(4,4)=1e8;K(6,6)=1e8;K(7,7)=1e8;K(8,8)=1e8;K(9,9)=1e8;K(10,10)=1e8;K(12,12)=1e8;
K(109,109)=1e8;K(110,110)=1e8;K(111,111)=1e8;K(112,112)=1e8;K(114,114)=1e8;K(115,115)=1e8;K(116,116)=1e8;
K(117,117)=1e8;K(118,118)=1e8;K(120,120)=1e8;
...........
Well my problem is that i couldnt take inverse of Assembly stiffnes matrix K which is K 264x264 matrix.. what would be the reason for that ..
i used space frame elements to model beams in 3D
can any one give me idea about it..how can i solve this..
%----------D matrix (includes connectivity information) ------------
%-----------------------------------------------------------------------------------------
D = [1 2 4 3 5 8 10 9 11 14 16 15 19 20 21 22 24 25 27 28 30 31 33 34 37 39 41 43 ;
3 4 6 7 9 10 12 13 15 16 17 18 22 21 23 26 28 27 29 32 34 33 35 36 38 40 42 44 ];
%-----------------------------------------------------------------------------------------
%--------- Transformation matrices--------------------------------------------------------
T11=[-1/sqrt(2) 0 1/sqrt(2);
0 1 0 ;
-1/sqrt(2) 0 -1/sqrt(2)];
T22=[1/sqrt(2) 0 1/sqrt(2);
0 1 0 ;
-1/sqrt(2) 0 1/sqrt(2)];
T33=[0 1 0;
-1 0 0;
0 0 1];
O=zeros(3,3);
T1=[T11 O O O;
O T11 O O;
O O T11 O;
O O O T11];
T2=[T22 O O O;
O T22 O O;
O O T22 O;
O O O T22];
T3=[T33 O O O;
O T33 O O;
O O T33 O;
O O O T33];
%----------------------------------------------------------------------------------------------
numel=28; % numel=number of element
nnode=44; % nnode=number of nodes
ndof=6; % ndof= number of dof of a node
K=zeros(nnode*ndof,nnode*ndof);
%L=zeros(1,numelb);EA=zeros(1,numelb);EIy=zeros(1,numelb);EIz=zeros(1,numelb);GIx=zeros(1,numelb)
for n=1:numel
%--------assigning lenghts,material properties etc..------------------------------
if n>=1 & n<=24
L=750;EA=1.792e8;EIy=1.423e11;EIz=4.601e10;GIx=5.461e10;
else
L=760;EA=9.048e7;EIy=1.484e10;EIz=1.484e10;GIx=1.187e10;
end
%------stiffness matrix(12*12)----------------------------------------------------
k=[EA/L, 0, 0, 0, 0, 0, -EA/L, 0, 0, 0, 0, 0;
0, 12*EIz/L^3, 0, 0, 0, 6*EIz/L^2, 0,-12*EIz/L^3,0, 0, 0, 6*EIz/L^2;
0, 0, 12*EIy/L^3,0,6*EIy/L^2,0, 0, 0,-12*EIy/L^3,0,-6*EIy/L^2,0;
0, 0, 0, GIx/L 0, 0, 0, 0, 0, -GIx/L 0, 0;
0, 0,6*EIy/L^2, 0, 4*EIy/L, 0, 0, 0, 6*EIy/L^2,0, 2*EIy/L, 0;
0, 6*EIz/L^2 0, 0, 0, 4*EIy/L, 0, -6*EIz/L^2 0, 0, 0, 2*EIz/L;
-EA/L 0, 0, 0, 0, 0, EA/L 0, 0, 0, 0, 0;
0, -12*EIz/L^3 0, 0, 0,-6*EIz/L^2 0, 12*EIz/L^3 0, 0, 0, -6*EIz/L^2;
0, 0, -12*EIy/L^3,0,6*EIy/L^2,0, 0, 0, 12*EIy/L^3,0, 6*EIy/L^2,0;
0, 0, 0, -GIx/L 0, 0, 0, 0, 0, GIx/L 0, 0;
0, 0,-6*EIy/L^2, 0, 2*EIy/L, 0, 0, 0, 6*EIy/L^2,0, 4*EIy/L, 0;
0, 6*EIz/L^2 0, 0, 0, 2*EIy/L, 0, -6*EIz/L^2 0, 0, 0, 4*EIz/L];
%----coordinate transformation------------------------------------------------------
if n==1|n==4|n==5|n==8|n==9|n==12|n==13|n==16|n==17|n==20|n==21|n==24
k=T1.'*k*T1;
elseif n==2|n==3|n==6|n==7|n==10|n==11|n==14|n==15|n==18|n==19|n==22|n==23
k=T2.'*k*T2;
else
k=T3.'*k*T3;
end
%--------assembly--------------------------------------------------------------------
a= D(1,n); % a= first node of nth element
b= D(2,n); % b= second node of nth element
for i=1:ndof
for j=1:ndof % ndof= number of dof of a node
K((a-1)*ndof+i,(a-1)*ndof+j)=K((a-1)*ndof+i,(a-1)*ndof+j)+k(i,j);
K((b-1)*ndof+i,(b-1)*ndof+j)=K((b-1)*ndof+i,(b-1)*ndof+j)+k(ndof+i,ndof+j);
K((a-1)*ndof+i,(b-1)*ndof+j)=K((a-1)*ndof+i,(b-1)*ndof+j)+k(i,ndof+j);
K((b-1)*ndof+i,(a-1)*ndof+j)=K((b-1)*ndof+i,(a-1)*ndof+j)+k(ndof+i,j);
end
end
end
%---------force vector-----------------------------------------------------------------1e8
syms dd
F(1,1)=dd;
F(2:264,1)=0;
syms q
F(99,1)=-498198*q;F(105,1)=-498198*q; F(207,1)=-498198*q; F(213,1)=-498198*q;
F(1,1)=0;
%----------------------------imposing boundary conditions------------------------------
K(1,1)=1e8;K(2,2)=1e8;K(3,3)=1e8;K(4,4)=1e8;K(6,6)=1e8;K(7,7)=1e8;K(8,8)=1e8;K(9,9)=1e8;K(10,10)=1e8;K(12,12)=1e8;
K(109,109)=1e8;K(110,110)=1e8;K(111,111)=1e8;K(112,112)=1e8;K(114,114)=1e8;K(115,115)=1e8;K(116,116)=1e8;
K(117,117)=1e8;K(118,118)=1e8;K(120,120)=1e8;
...........
Well my problem is that i couldnt take inverse of Assembly stiffnes matrix K which is K 264x264 matrix.. what would be the reason for that ..
i used space frame elements to model beams in 3D
can any one give me idea about it..how can i solve this..