Anda di halaman 1dari 10

LINEAR BAR ELEMENTS

FUNCTIONS
function y=LBES(E,A,L)
% LBES stands for Linear bar element Stiffness
y=[E*A/L,-E*A/L;-E*A/L E*A/L];

function y=LBA(K,k,i,j)
%LBA Stands for Linear Bar Assemble. it places
element stiffness matrix
%elemnts in the global Stiffness Matrix
K(i,i)=K(i,i)+k(1,1);
K(i,j)=K(i,j)+k(1,2);
K(j,i)=K(j,i)+k(2,1);
K(j,j)=K(j,j)+k(2,2);
y=K;

function y=LBEF(k,u)
%LBEF stands for Linear bar Element forces
y=k*u;

function y=LBESt(k,u,A)
% LBES stands for Linear Bar Element Stresses
y=k*u/A;
PROBLEM NO. 1(A)
%Calculating Element Stiffness Matrices
L1=1; L2=1;
E=210e6;A=4e-4;
k1=LBES(E,A,L1)
k2=LBES(E,A,L2)
%Assembling the Stiffness Matrices
K=zeros(3,3);
K=LBA(K,k1,1,2);
K=LBA(K,k2,2,3);
%By Partioning
k=K(2:3,2:3);
f=[0;-10];
u=k\f;
%Nodal Displacements and Element Forces
U=[0;u]
F=K*U
u1=[0;U(2)]
f1=LBEF(k1,u1)
u2=[U(2);U(3)]
f2=LBEF(k2,u2)
% Stresses
sigma1=f1/A;
sigma2=f2/A;
PROBLEM NO.1 (B)
E=30e6;
A=4;
L1=30;
L2=30;
L3=30;
%Step No.1 Finding Out the Element Stiffness Matrix
k1=LBES(E,A,L1)
k2=LBES(E,A,L2)
k3=LBES(E,A,L3)
%Assembling into the Global Stiffness Matrix
K=zeros(4,4);
K=LBA(K,k1,1,2);
K=LBA(K,k2,2,3);
K=LBA(K,k3,3,4)
%By partitioning
k=K(2:3,2:3)
f=[5000;-10000];
u=k\f
%Nodal Displacements and Forces
U=[0;u;0]
F=K*U
u1=[0;u(1)]
f1=LBEF(k1,u1)
u2=[u(1);u(2)]
f2=LBEF(k2,u2)
u3=[u(2);0]
f3=LBEF(k3,u3)
PROBLEM NO.1 (C)
%Determine The Element Stiffness Matrix
E1=200e6; E2=70e6;
A1=4e-4; L1=1; A2=2e-4; L2=1;
k1=LBES(E1,A1,L1)
k2=LBES(E2,A2,L2)
%Assembling into the Global Stiffness Matrix
K=zeros(3,3);
K=LBA(K,k1,1,2)
K=LBA(K,k2,2,3)
% By partioning
k=K(2:3,2:3)
f=[0;-40]
u=k\f;
%Nodal Displacements and forces
U=[0;u]
F=K*U
u1=[0;u(1)]
f1=LBEF(k1,u1)
u2=[u(1);u(2)]
f2=LBEF(k2,u2)
2-D TRUSS ELEMENTS
FUNCTIONS
function y=PTEL(x1,y1,x2,y2)
%PTEL Stands for Plane Truss Element Length
y=sqrt((x2-x1)^2+(y2-y1)^2);

function y=PTES(E,A,L,theta)
%PTES Stands for Plane Truss Element Stiffness
x=theta*pi/180;
C=cos(x);
S=sin(x);
y=E*A/L*[C*C, C*S, -C*C, -C*S;C*S, S*S, -C*S, -S*S ;
-C*C, -C*S, C*C, C*S ; -C*S, -S*S, C*S, S*S];

function y = PTA(K,k,i,j)
%PlaneTrussAssemble This function assembles the element stiffness
% matrix k of the plane truss element with nodes
% i and j into the global stiffness matrix K.
% This function returns the global stiffness
% matrix K after the element stiffness matrix
% k is assembled.
K(2*i-1,2*i-1) = K(2*i-1,2*i-1) + k(1,1) ;
K(2*i-1,2*i) = K(2*i-1,2*i) + k(1,2) ;
K(2*i-1,2*j-1) = K(2*i-1,2*j-1) + k(1,3) ;
K(2*i-1,2*j) = K(2*i-1,2*j) + k(1,4) ;
K(2*i,2*i-1) = K(2*i,2*i-1) + k(2,1) ;
K(2*i,2*i) = K(2*i,2*i) + k(2,2) ;
K(2*i,2*j-1) = K(2*i,2*j-1) + k(2,3) ;
K(2*i,2*j) = K(2*i,2*j) + k(2,4) ;
K(2*j-1,2*i-1) = K(2*j-1,2*i-1) + k(3,1) ;
K(2*j-1,2*i) = K(2*j-1,2*i) + k(3,2) ;
K(2*j-1,2*j-1) = K(2*j-1,2*j-1) + k(3,3) ;
K(2*j-1,2*j) = K(2*j-1,2*j) + k(3,4) ;
K(2*j,2*i-1) = K(2*j,2*i-1) + k(4,1) ;
K(2*j,2*i) = K(2*j,2*i) + k(4,2) ;
K(2*j,2*j-1) = K(2*j,2*j-1) + k(4,3) ;
K(2*j,2*j) = K(2*j,2*j) + k(4,4) ;
y = K;

function y = PTEF(E,A,L,theta,u)
%PlaneTrussElementForce This function returns the element force
% given the modulus of elasticity E, the
% cross-sectional area A, the length L,
% the angle theta (in degrees), and the
% element nodal displacement vector u.
x = theta* pi/180;
C = cos(x);
S = sin(x);
y = E*A/L*[1 -1;-1 1]*[C S 0 0;0 0 C S]* u;
PROBLEM NO.2
A=0.00129;
E=206.842e6;
L1=PTEL(0,0,0,1.8288)
L2=PTEL(0,0,2.7432,0)
L3=PTEL(0,0,-2.7432,1.8288)
theta1=90
k1=PTES(E,A,L1,theta1)
theta2=0
k2=PTES(E,A,L2,theta2)
theta3=180-atan(1.8288/2.7432)*180/pi
k3=PTES(E,A,L3,theta3)
K=zeros(6,6);
K=PTA(K,k1,1,2);
K=PTA(K,k2,2,3);
K=PTA(K,k3,1,3)
k=[K(4,4:5);K(5,4:5)]
f=[-88.964;44.482]
u=k\f
U=[0;0;0;u(1);u(2);0]
F=K*U
u1=[U(1);U(2);U(3);U(4)]
u2=[U(2);U(4);U(5);U(6)]
u3=[U(1);U(2);U(5);U(6)]

f1=PTEF(E,A,L1,theta1,u1)
f2=PTEF(E,A,L2,theta2,u2)
f3=PTEF(E,A,L3,theta3,u3)
PROBLEM NO.3
A=0.00129;
E=206.842e6;
L1=PTEL(0,0,0,1.8288);
L2=PTEL(0,0,2.7432,0);
L3=PTEL(0,0,-2.7432,1.8288);
theta1=90;
k1=PTES(E,A,L1,theta1);
theta2=0;
k2=PTES(E,A,L2,theta2);
theta3=180-atan(1.8288/2.7432)*180/pi;
k3=PTES(E,A,L3,theta3);
K=zeros(6,6);
K=PTA(K,k1,1,2);
K=PTA(K,k2,2,3);
K=PTA(K,k3,1,3);
k=[K(4:6,4:6)]
u1=0;u2=0;u3=0;u4=0;u5=-6.1889e-3;u6=-0.0254;
U=[u1;u2;u3;u4;u5;u6];
F=K*U;
U1=[u1;u2;u3;u4];
U2=[u3;u4;u5;u6];
U3=[u1;u2;u5;u6];
f1=PTEF(E,A,L1,theta1,U1)
f2=PTEF(E,A,L2,theta2,U2)
f3=PTEF(E,A,L3,theta3,U3)
PROBLEM NO.4

E=210e6;
A=0.001;
L1=PTEL(0,0,4,0);
L2=PTEL(0,0,-4,3);
L3=PTEL(4,0,4,3);
theta1=0; theta3=90; theta2=180-atan(3/4)*180/pi;
k1=PTES(E,A,L1,theta1)
k2=PTES(E,A,L2,theta2)
k3=PTES(E,A,L3,theta3)
K=zeros(8,8);
K=PTA(K,k1,1,2);
K=PTA(K,k2,2,3);
K=PTA(K,k3,2,4)
k=[K(3:4,3:4)]

f=[10;17.3204];
u=k\f
U=[0;0;u(1);u(2);0;0;0;0]
F=K*U
u1=[U(1);U(2);U(3);U(4)]
u2=[U(3);U(4);U(5);U(6)]
u3=[U(3);U(4);U(7);U(8)]
f1=PTEF(E,A,L1,theta1,u1)
f2=PTEF(E,A,L2,theta2,u2)
f3=PTEF(E,A,L3,theta3,u3)
PROBLEM NO.5
E=210e6;
A=0.001;
L1=PTEL(0,0,4,0);
L2=PTEL(0,0,-4,3);
L3=PTEL(4,0,4,3);
theta1=0; theta3=90; theta2=180-atan(3/4)*180/pi;
k1=PTES(E,A,L1,theta1)
k2=PTES(E,A,L2,theta2)
k3=PTES(E,A,L3,theta3)
K=zeros(8,8);
K=PTA(K,k1,1,2)
K=PTA(K,k2,2,3)
K=PTA(K,k3,2,4)
k=[K(1,1) K(1,3:4);K(3,1) K(3,3:4); K(4,1) K(4,3:4)]
U=[0.05;0;0.0354;8.588e-3;0;0;0;0]
u1=[U(1);U(2);U(3);U(4)]
u2=[U(3);U(4);U(5);U(6)]
u3=[U(3);U(4);U(7);U(8)]

f1=PTEF(E,A,L1,theta1,u1)
f2=PTEF(E,A,L2,theta2,u2)
f3=PTEF(E,A,L3,theta3,u3)
PROBLEM NO.6
E=206.842e6;
A1=0.00258; A2=0.00129; A3=0.00387;
L1=PTEL(0,0,3.048,0);
L2=PTEL(0,0,3.048,0);
L3=PTEL(0,0,3.048,3.6576);
L4=PTEL(0,0,0,3.6576);
L5=PTEL(0,0,-3.048,3.6576);
L6=PTEL(0,0,3.048,0);
theta1=0; theta2=0;theta3=atan(L4/L1)*180/pi;
theta4=90; theta5=180-theta3;
theta6=0;
k1=PTES(E,A1,L1,theta1)
k2=PTES(E,A1,L2,theta2)
k3=PTES(E,A1,L3,theta3)
k4=PTES(E,A2,L4,theta4)
k5=PTES(E,A3,L5,theta5)
k6=PTES(E,A3,L6,theta6)
K=zeros(10);
K=PTA(K,k1,1,2);
K=PTA(K,k2,2,3);
K=PTA(K,k3,1,4);
K=PTA(K,k4,2,4);
K=PTA(K,k5,3,4);
K=PTA(K,k6,4,5)
k=[K(3:8,3:8)]
F=[0;0;0;88.964;88.964;0]
u=k\F; U=[0;0;u;0;0]
u1=[U(1);U(2);U(3);U(4)]
u2=[U(3);U(4);U(5);U(6)]
u3=[U(1);U(2);U(7);U(8)]
u4=[U(3);U(4);U(7);U(8)]
u5=[U(5);U(6);U(7);U(8)]
u6=[U(7);U(8);U(9);U(10)]
f1=PTEF(E,A1,L1,theta1,u1)
f2=PTEF(E,A1,L2,theta2,u2)
f3=PTEF(E,A1,L3,theta3,u3)
f4=PTEF(E,A2,L4,theta4,u4)
f5=PTEF(E,A3,L5,theta5,u5)
f6=PTEF(E,A3,L6,theta6,u6)