Professional Documents
Culture Documents
%
%
%
%
%
%
%
%
%
%
%
%
%
%
%
%
%
%
%
%
%
%
%
%
%
%
%
%
x,
x,
x,
x,
x,
x,
x,
x,
number of elements
number of nodes per element
number of dofs per node
total number of nodes in system
total system dofs
y
y
y
y
y
y
y
y
coord.
coord.
coord.
coord.
coord.
coord.
coord.
coord.
values
values
values
values
values
values
values
values
of
of
of
of
of
of
of
of
node
node
node
node
node
node
node
node
1
2
3
4
5
6
7
8
in
in
in
in
in
in
in
in
terms
terms
terms
terms
terms
terms
terms
terms
of
of
of
of
of
of
of
of
the
the
the
the
the
the
the
the
elastic modulus
cross-sectional area
moment of inertia of cross-section
axial didplacement at node 1 is constrained
whose described value is 0
transverse deflection at node 1 is constrained
whose described value is 0
slope at node 1 is constrained
whose described value is 0
axial didplacement at node 8 is constrained
whose described value is 0
transverse deflection at node 8 is constrained
whose described value is 0
slope at node 8 is constrained
whose described value is 0
ff=zeros(sdof,1);
% initialization of system force vector
kk=zeros(sdof,sdof);
% initialization of system matrix
index=zeros(nel*ndof,1); % initialization of index vector
global
global
global
global
global
global
global
global
axis
axis
axis
axis
axis
axis
axis
axis
ff(11)=-75000;
ff(14)=-60000;
ff(17)=-50000;
nodes(1,2)=3;
nodes(2,2)=3;
nodes(3,2)=4;
nodes(4,2)=5;
nodes(5,2)=6;
nodes(6,2)=7;
nodes(7,2)=8;
% loop for the total number of elements
nd(1)=nodes(iel,1);
nd(2)=nodes(iel,2);
x1=x(nd(1)); y1=y(nd(1));
x2=x(nd(2)); y2=y(nd(2));
kk=feasmbl1(kk,k,index);
end
[kk,ff]=FEAPLYC2(kk,ff,bcdof,bcval); % apply the boundary conditions
disp=1000*(kk\ff);
0.0000
-0.0000;
0
-7.6028;
27.0856
-3.5988;
7.0000 -7.6028;
8.0000
5.4930
9.0000 -3.5988;
10.0000 -7.6561;
11.0000 -15.6010;
12.0000 -4.6186;
13.0000 -7.6961;
14.0000 -22.0244;
15.0000
0.5753
16.0000 -7.7627;
17.0000
-6.0806;
18.0000
3.4899
19.0000 -7.7627;
20.0000 14.8589
21.0000
3.4899
22.0000
0
23.0000
0
24.0000
0
function[index]=feeldof(nd,nnel;ndof)
%---------------------------------------------------------% Purpose:
%
Compute system dofs associated with each element
%
% Synopsis:
%
[index]=feeldof(nd,nnel,ndof)
%
% Variable Description:
%
index - system dof vector associated with element "iel"
%
iel - element number whose system dofs are to be determined
%
nnel - number of nodes per element
%
ndof - number of dofs per node
%----------------------------------------------------------edof=nnel*ndof;
k=0;
for i=1:nnel
start = (nd(i)-1)*ndof;
for j=1:ndof
k=k+1;
index(k)=start+j;
end
end
function [k]=frameel(E,I;L;A;beta)
%-------------------------------------------------------------% Purpose:
%
Stiffness and mass matrices for the 2-d frame element
%
nodal dof {u_1 v_1 theta_1 u_2 v_2 theta_2}
%
% Synopsis:
%
[k]=frameel(E,I,L,A,beta)
%
% Variable Description:
%
k - element stiffness matrix (size of 6x6)
%
E - elastic modulus
%
I - second moment of inertia of cross-section
%
L - element length
%
A - area of beam cross-section
%
beta - angle between the local and global axes
%
is positive if the local axis is in the ccw direction from
%
the global axis
%-------------------------------------------------------------------------% stiffness matrix at the local axis
a=E*A/L;
c=E*I/(L^3);
kl=[a 0
0 12*c
0 6*L*c
-a 0
0 -12*c
0 6*L*c
0
6*L*c
4*L^2*c
0
-6*L*c
2*L^2*c
-a
0
0
a
0
0
0
-12* c
-6*L*c
0
12*c
-6*L*c
0;...
6*L*c;...
2*L^2*c;...
0;...
-6*L*c;...
4*L^2*c];
sin(beta)
cos(beta)
0
0
0
0
0 0
0
0 0
0
1 0
0
0 cos(beta) sin(beta)
0 -sin(beta) cos(beta)
0 0
0
0;...
0;...
0;...
0;...
0;...
1];
function [kk,ff]=feaplyc2(kk,ff;bcdof;bcval)
%---------------------------------------------------------% Purpose:
%
Apply constraints to matrix equation [kk]{x}={ff}
%
% Synopsis:
%
[kk,ff]=feaplyc2(kk,ff,bcdof,bcval)
%
% Variable Description:
%
kk - system matrix before applying constraints
%
ff - system vector before applying constraints
%
bcdof - a vector containging constrained d.o.f
%
bcval - a vector containing contained value
%
%----------------------------------------------------------n=length(bcdof);
sdof=size(kk);
for i=1:n
c=bcdof(i);
for j=1:sdof
kk(c,j)=0;
end
kk(c,c)=1;
ff(c)=bcval(i);
end