Вы находитесь на странице: 1из 5

Abid Yusuf

20MMF0019

% To calculate the nodal deformation of a small triangular truss

% All parameters are in N and mm

A=500;

E=200000;

% NO is number of nodes EL is the number of elements

NO=3;

EL=3;

load('elet.mat','-ascii')

load('nodet.mat','-ascii')

elet

K=zeros(2*NO,2*NO);

KI=zeros(4,4);

% Computing the element stiffness and global stiffness

matrix for k=1:EL

%Start node number is i and end node number is j

i=elet(k,2);

j=elet(k,3);

xi=nodet(i,2);

yi=nodet(i,3);

xj=nodet(j,2);

yj=nodet(j,3);

l=sqrt((xj-xi)^2+(yj-yi)^2);

the=atan((yj-yi)/(xj-xi));
aebyl=A*E/l;

%cc=square of cos theta into AE/L

cc=aebyl*cos(the)*cos(the);

ss=aebyl*sin(the)*sin(the);

sc=aebyl*sin(the)*cos(the);

K(2*i-1,2*i-1)=K(2*i-1,2*i-1)+cc;

K(2*i-1,2*i)=K(2*i-1,2*i)+sc;

K(2*i,2*i-1)=K(2*i,2*i-1)+sc;

K(2*i,2*i)=K(2*i,2*i)+ss;

K(2*i-1,2*j-1)=K(2*i-1,2*j-1)-cc;

K(2*i-1,2*j)=K(2*i-1,2*j)-sc;

K(2*i,2*j-1)=K(2*i,2*j-1)-sc;

K(2*i,2*j)=K(2*i,2*j)-ss;

K(2*j-1,2*i-1)=K(2*j-1,2*i-1)-cc;

K(2*j-1,2*i)=K(2*j-1,2*i)-sc;

K(2*j,2*i-1)=K(2*j,2*i-1)-sc;

K(2*j,2*i)=K(2*j,2*i)-ss;

K(2*j-1,2*j-1)=K(2*j-1,2*j-1)+cc;

K(2*j-1,2*j)=K(2*j-1,2*j)+sc;

K(2*j,2*j-1)=K(2*j,2*j-1)+sc;

K(2*j,2*j)=K(2*j,2*j)+ss;

End
disp(K)

bc(1)=1;

bc(2)=3;

bc(3)=4;

bcal(1)=0;

bcal(2)=0;

bcal(3)=0;

P=[0;0;0;0;-10000];

for i=1:3

j=bc(i);

val=bcal(i);

for i=1:6

K(j,i)=0;

K(i,j)=0;

end

end

disp(K)

U=K\P
>> truss

elet =

1 1 2

2 2 3

3 3 1

K =
1.0e+05 *

0.0000 0.0000 -0.0000 -0.0000 0 0


0.0000 1.0000 -0.0000 -1.0000 0 0
-0.0000 -0.0000 0.0000 0.0000 0 0
-0.0000 -1.0000 0.0000 1.0000 0 0
0 0 0 0 0 0
0 0 0 0 0 0
K =
1.0e+05 *

0.0000 0.0000 -0.0000 -0.0000 0 0


0.0000 1.0000 -0.0000 -1.0000 0 0
-0.0000 -0.0000 0.3536 -0.3536 -0.3536 0.3536
-0.0000 -1.0000 -0.3536 1.3536 0.3536 -0.3536
0 0 -0.3536 0.3536 0.3536 -0.3536
0 0 0.3536 -0.3536 -0.3536 0.3536

K =
1.0e+05 *

1.0000 0.0000 -0.0000 -0.0000 -1.0000 0


0.0000 1.0000 -0.0000 -1.0000 0 0
-0.0000 -0.0000 0.3536 -0.3536 -0.3536 0.3536
-0.0000 -1.0000 -0.3536 1.3536 0.3536 -0.3536
-1.0000 0 -0.3536 0.3536 1.3536 -0.3536
0 0 0.3536 -0.3536 -0.3536 0.3536
After applying boundary conditions
>> truss

elet =

1 1 2
2 2 3
3 3 1

1.0e+05 *

1.0000 0.0000 -0.0000 -0.0000 -1.0000 0


0.0000 1.0000 -0.0000 -1.0000 0 0
-0.0000 -0.0000 0.3536 -0.3536 -0.3536 0.3536
-0.0000 -1.0000 -0.3536 1.3536 0.3536 -0.3536
-1.0000 0 -0.3536 0.3536 1.3536 -0.3536
0 0 0.3536 -0.3536 -0.3536 0.3536

1.0e+05 *

0 0 0 0 0 0
0 1.0000 0 0 0 0
0 0 0 0 0 0
0 0 0 0 0 0
0 0 0 0 1.3536 -0.3536
0 0 0 0 -0.3536 0.3536

Вам также может понравиться