Download as txt, pdf, or txt
Download as txt, pdf, or txt
You are on page 1of 1

clc;

clear;

%Input
E = 70e6;
A1 = pi*(0.05^2);
A2 = pi*(0.025^2);
L1 = 0.11;
L2 = 0.09;
P = 100;
q = 12.5;
%Solution
k1 = A1*E* [1/(L1) -1/(L1);
-1/(L1) 1/(L1)];
k2 = A2*E* [1/(L2) -1/(L2);
-1/(L2) 1/(L2)];

r1 = [q*L1/2 q*L1/2];

%Assemble global matrix


K = zeros(4);
K(1:2, 1:2) = K(1:2, 1:2) + k1;
K(2:3, 2:3) = K(2:3, 2:3) + k2;
K(3:4, 3:4) = K(3:4, 3:4) + k2;

R = zeros(4,1);
R(1:2) = R(1:2) + r1';

%Point load,P at end of bar


R(3) = R(3) + P;

%Solve global displacement


U = zeros (4,1);
U(2:3) = K(2:3,2:3)\R(2:3)

%FEM solution
%Internal force or reaction
b1 = k1*[U(1);U(2)] - r1'
b2 = k2*[U(2);U(3)]
b3 = k2*[U(3);U(4)]

%Internal stress
sig1 = b1/A1
sig2 = b2/A2
sig3 = b3/A2

You might also like