You are on page 1of 5

CODE:-

close all
clear all
clc

syms P real;

%Length of elements
L1=0.5;
L2=0.5;
L3=1.0;
L4=0.5;
L5=0.5;

Width=1.0;
Thickness=0.05;
Modulus=200e3; %Steel (MPa)

Imoment=Width*Thickness*Thickness*Thickness/12;

%Local stiffness matrices


L=L1;
K1= ((Modulus*Imoment)/L^3)*[12 6*L -12 6*L;
6*L 4*L*L -6*L 2*L*L;
-12 -6*L 12 -6*L;
6*L 2*L*L -6*L 4*L*L];

L=L2;
K2= ((Modulus*Imoment)/L^3)*[12 6*L -12 6*L;
6*L 4*L*L -6*L 2*L*L;
-12 -6*L 12 -6*L;
6*L 2*L*L -6*L 4*L*L];

L=L3;
K3= ((Modulus*Imoment)/L^3)*[12 6*L -12 6*L;
6*L 4*L*L -6*L 2*L*L;
-12 -6*L 12 -6*L;
6*L 2*L*L -6*L 4*L*L];

L=L4;
K4= ((Modulus*Imoment)/L^3)*[12 6*L -12 6*L;
6*L 4*L*L -6*L 2*L*L;
-12 -6*L 12 -6*L;
6*L 2*L*L -6*L 4*L*L];

L=L5;
K5= ((Modulus*Imoment)/L^3)*[12 6*L -12 6*L;
6*L 4*L*L -6*L 2*L*L;
-12 -6*L 12 -6*L;
6*L 2*L*L -6*L 4*L*L];

%Assemblage matrix
KA= zeros(12,12); % Defining a null stiffness assemblage matrix
for i=1:2
for j=1:2
KA(i,j) = K1(i,j);
KA(i,j+2) = K1(i,j+2);
KA(i+2,j) = K1(i+2,j);
KA(i+2,j+2) = K1(i+2,j+2) + K2(i,j);
KA(i+2,j+4) = K2(i,j+2);

KA(i+4,j+2) = K2(i+2,j);
KA(i+4,j+4) = K2(i+2,j+2) + K3(i,j);
KA(i+4,j+6) = K3(i,j+2);

KA(i+6,j+4) = K3(i+2,j);
KA(i+6,j+6) = K3(i+2,j+2) + K4(i,j);
KA(i+6,j+8) = K4(i,j+2);

KA(i+8,j+6) = K4(i+2,j);
KA(i+8,j+8) = K4(i+2,j+2) + K5(i,j);
KA(i+8,j+10) = K5(i,j+2);

KA(i+10,j+8) = K5(i+2, j);


KA(i+10,j+10) = K5(i+2,j+2);
end
end
KA(12,12) = KA(12,12)

% BC's, loading and solution, Method 3


[~,nd] = size(KA);

% Initial list of degree of freedom


dof = (1:nd)';

% Degree of freedom to be removed due to BC's


bc = [3,9];
dof(bc) = [];

% K contains only the desired degree of freedom


K = KA(dof,dof)
F3 = [0 0 0 -P 0 -P 0 0 0 0];

F3 = F3'
U3 = vpa([K\F3],4)

K1 = inv(K)
U1 = vpa([K1*F3],4)

% Verfification of result
UA =
vpa([U3(1,1);U3(2,1);0;U3(3,1);U3(4,1);U3(5,1);U3(6,1);U3(7,1);0;U3(8,1);U3(9,1);U3
(10,1)],4)
FA = vpa(KA*UA,4)

RESULT
KA =

200.0000 50.0000 -200.0000 50.0000 0 0 0 0


0 0 0 0
50.0000 16.6667 -50.0000 8.3333 0 0 0 0
0 0 0 0
-200.0000 -50.0000 400.0000 0 -200.0000 50.0000 0 0
0 0 0 0
50.0000 8.3333 0 33.3333 -50.0000 8.3333 0 0
0 0 0 0
0 0 -200.0000 -50.0000 225.0000 -37.5000 -25.0000 12.5000
0 0 0 0
0 0 50.0000 8.3333 -37.5000 25.0000 -12.5000 4.1667
0 0 0 0
0 0 0 0 -25.0000 -12.5000 225.0000 37.5000
-200.0000 50.0000 0 0
0 0 0 0 12.5000 4.1667 37.5000 25.0000
-50.0000 8.3333 0 0
0 0 0 0 0 0 -200.0000 -50.0000
400.0000 0 -200.0000 50.0000
0 0 0 0 0 0 50.0000 8.3333
0 33.3333 -50.0000 8.3333
0 0 0 0 0 0 0 0
-200.0000 -50.0000 200.0000 -50.0000
0 0 0 0 0 0 0 0
50.0000 8.3333 -50.0000 16.6667

K =

200.0000 50.0000 50.0000 0 0 0 0 0


0 0
50.0000 16.6667 8.3333 0 0 0 0 0
0 0
50.0000 8.3333 33.3333 -50.0000 8.3333 0 0 0
0 0
0 0 -50.0000 225.0000 -37.5000 -25.0000 12.5000 0
0 0
0 0 8.3333 -37.5000 25.0000 -12.5000 4.1667 0
0 0
0 0 0 -25.0000 -12.5000 225.0000 37.5000 50.0000
0 0
0 0 0 12.5000 4.1667 37.5000 25.0000 8.3333
0 0
0 0 0 0 0 50.0000 8.3333 33.3333
-50.0000 8.3333
0 0 0 0 0 0 0 -50.0000
200.0000 -50.0000
0 0 0 0 0 0 0 8.3333
-50.0000 16.6667

F3 =

0
0
0
-P
0
-P
0
0
0
0

U3 =

0.09*P
-0.18*P
-0.18*P
-0.08*P
-0.12*P
-0.08*P
0.12*P
0.18*P
0.09*P
0.18*P

K1 =

0.1000 -0.2200 -0.1600 -0.0525 -0.0550 -0.0375 0.0650 0.0800


0.0400 0.0800
-0.2200 0.5600 0.3200 0.1050 0.1100 0.0750 -0.1300 -0.1600
-0.0800 -0.1600
-0.1600 0.3200 0.3200 0.1050 0.1100 0.0750 -0.1300 -0.1600
-0.0800 -0.1600
-0.0525 0.1050 0.1050 0.0450 0.0600 0.0350 -0.0600 -0.0750
-0.0375 -0.0750
-0.0550 0.1100 0.1100 0.0600 0.1400 0.0600 -0.1000 -0.1300
-0.0650 -0.1300
-0.0375 0.0750 0.0750 0.0350 0.0600 0.0450 -0.0600 -0.1050
-0.0525 -0.1050
0.0650 -0.1300 -0.1300 -0.0600 -0.1000 -0.0600 0.1400 0.1100
0.0550 0.1100
0.0800 -0.1600 -0.1600 -0.0750 -0.1300 -0.1050 0.1100 0.3200
0.1600 0.3200
0.0400 -0.0800 -0.0800 -0.0375 -0.0650 -0.0525 0.0550 0.1600
0.1000 0.2200
0.0800 -0.1600 -0.1600 -0.0750 -0.1300 -0.1050 0.1100 0.3200
0.2200 0.5600

U1 =

0.09*P
-0.18*P
-0.18*P
-0.08*P
-0.12*P
-0.08*P
0.12*P
0.18*P
0.09*P
0.18*P
UA =

0.09*P
-0.18*P
0
-0.18*P
-0.08*P
-0.12*P
-0.08*P
0.12*P
0
0.18*P
0.09*P
0.18*P

FA =

0
0
1.0*P
0
-1.0*P
0
-1.0*P
0
1.0*P
0
0
0

You might also like