Sie sind auf Seite 1von 6

// calculate the stiffness matrix for a regular plan frame

// author F. Paulet-Crainiceanu
// version 1.0 / december 2006
clear
mode(0)
disp('')
disp('')
disp('
disp('
disp('
disp('')
disp('')

*******************************************')
*** CALCULATION OF THE STIFFNESS MATRIX ***')
*******************************************')

n=0;
while n<1
n=input('Number of levels = ');
if n<1 then
disp('error, no.of levels should be >= 1')
disp('')
end
end
disp('')
m=0;
while m<1
m=input('Number of spans = ');
if m<1 then
disp('error, no.of spans should be >= 1')
disp('')
end
end
disp('')
EI=0;
while EI<=0
EI=input('E*I = ');
if EI<=0 then
disp('error, E*I should be > 0')
disp('')
end
end
disp('')
disp('')
disp('
** LEVEL HEIGHTS:')
disp('')
for i=1:n
h(i)=0;
while h(i)<=0
h(i)=input(['Height of the level no.' + string(i) + '= ']);
if h(i)<=0 then
disp('error, height of the level should be > 0')
disp('')
end
end

end
disp('')
disp('')
disp('
** SPAN LENGTHS:')
disp('')
for j=1:m
l(j)=0;
while l(j)<=0
l(j)=input(['Length of the span no.' + string(j) + '= ']);
if l(j)<=0 then
disp('error, length of the span should be > 0')
disp('')
end
end
end
disp('')
disp('')
disp('
** E*I ratio for COLUMNS:')
for i=1:n
disp('')
disp([' * E*I ratio for columns at LEVEL no.' + string(i)])
disp('')
for j=1:m+1
c(i,j)=0;
while c(i,j)<=0
c(i,j)=input(['Level '+string(i)+', column '+string(j)+', E*I ratio
= ']);
if c(i,j)<=0 then
disp('error, E*I ratio should be > 0')
disp('')
end
end
end
end
disp('')
disp('')
disp('
** E*I ratio for BEAMS:')
for i=1:n
disp('')
disp([' * E*I ratio for beams at FLOOR no.' + string(i)])
disp('')
for j=1:m
b(i,j)=0;
while b(i,j)<=0
b(i,j)=input(['Floor '+string(i)+', span '+string(j)+', E*I ratio =
']);
if b(i,j)<=0 then
disp('error, E*I ratio should be > 0')
disp('')
end
end
end
end
disp('')

disp('')
// stiffness from floor displacements
// first floor
r(1,1)=0;
if n==1 then // first floor = last floor, one floor structure
for j=1:m+1
// translation dof
r(1,1)=r(1,1)+12*c(1,j)/h(1)^3;
p=n+j;
// rotational dof
r(p,1)=-6*c(1,j)/h(1)^2;
end
else // first floor, more than one floor structure
r(2,1)=0;
for j=1:m+1
// translation dof
r(1,1)=r(1,1)+12*(c(1,j)/h(1)^3+c(2,j)/h(2)^3);
r(2,1)=r(2,1)-12*c(2,j)/h(2)^3;
p=n+j;
// rotational dof
r(p,1)=6*(c(2,j)/h(2)^2-c(1,j)/h(1)^2);
r(p+m+1,1)=6*c(2,j)/h(2)^2;
end
end
// stiffness from floor displacements
// last floor
if n~=1 then // last floor, more than one floor structure
r(n,n)=0;
r(n-1,n)=0;
for j=1:m+1
// translation dof
r(n,n)=r(n,n)+12*c(n,j)/h(n)^3;
r(n-1,n)=r(n-1,n)-12*c(n,j)/h(n)^3;
// rotational dof
p=n+(n-1)*(m+1)+j;
r(p,n)=-6*c(n,j)/h(n)^2;
r(p-m-1,n)=-6*c(n,j)/h(n)^2;
end
end
// stiffness from floor displacements
// current floors
for i=2:n-1
r(i,i)=0;
r(i-1,i)=0;
r(i+1,i)=0;
for j=1:m+1
// translation dof
r(i,i)=r(i,i)+12*(c(i,j)/h(i)^3+c(i+1,j)/h(i+1)^3);
r(i-1,i)=r(i-1,i)-12*c(i,j)/h(i)^3;
r(i+1,i)=r(i+1,i)-12*c(i+1,j)/h(i+1)^3;
p=n+(i-1)*(m+1)+j;
// rotational dof

r(p,i)=6*(c(i+1,j)/h(i+1)^2-c(i,j)/h(i)^2);
r(p+m+1,i)=6*c(i+1,j)/h(i+1)^2;
r(p-m-1,i)=-6*c(i,j)/h(i)^2;
end
end
// stiffness from node rotation
// first floor
if n==1 then // first floor = last floor, one floor structure
// left node, j=1
// translation dof
r(1,2)=-6*c(1,1)/h(1)^2;
// rotational dof
r(2,2)=4*(c(1,1)/h(1)+b(1,1)/l(1));
r(3,2)=2*b(1,1)/l(1);
// right node, j=m+1
// translation dof
p=m+2;
r(1,p)=-6*c(1,m+1)/h(1)^2;
// rotational dof
r(p,p)=4*(c(1,m+1)/h(1)+b(1,m)/l(m));
r(p-1,p)=2*b(1,m)/l(m);
// current node
for j=2:m
// translation dof
p=n+j;
r(1,p)=-6*c(1,j)/h(1)^2;
// rotational dof
r(p,p)=4*(c(1,j)/h(1)+b(1,j-1)/l(j-1)+b(1,j)/l(j));
r(p-1,p)=2*b(1,j-1)/l(j-1);
r(p+1,p)=2*b(1,j)/l(j);
end
else // first floor, more than one floor structure
// left node, j=1
// translation dof
p=n+1;
r(1,p)=6*(-c(1,1)/h(1)^2+c(2,1)/h(2)^2);
r(2,p)=-6*c(2,1)/h(2)^2;
// rotational dof
r(p,p)=4*(c(1,1)/h(1)+c(2,1)/h(2)+b(1,1)/l(1));
r(p+1,p)=2*b(1,1)/l(1);
r(p+m+1,p)=2*c(2,1)/h(2);
// right node, j=m+1
// translation dof
p=n+m+1;
r(1,p)=6*(-c(1,m+1)/h(1)^2+c(2,m+1)/h(2)^2);
r(2,p)=-6*c(2,m+1)/h(2)^2;
// rotational dof
r(p,p)=4*(c(1,m+1)/h(1)+c(2,m+1)/h(2)+b(1,m)/l(m));
r(p-1,p)=2*b(1,m)/l(m);
r(p+m+1,p)=2*c(2,m+1)/h(2);
// current node
for j=2:m
// translation dof
p=n+j;
r(1,p)=6*(-c(1,j)/h(1)^2+c(2,j)/h(2)^2);

r(2,p)=-6*c(2,j)/h(2)^2;
// rotational dof
r(p,p)=4*(c(1,j)/h(1)+c(2,j)/h(2)+b(1,j-1)/l(j-1)+b(1,j)/l(j));
r(p-1,p)=2*b(1,j-1)/l(j-1);
r(p+1,p)=2*b(1,j)/l(j);
r(p+m+1,p)=2*c(2,j)/h(2);
end
end
// stiffness from node rotation
// last floor
if n~=1 then // last floor, more than one floor structure
// left node, j=1
p=n+(n-1)*(m+1)+1;
// translation dof
r(n,p)= -6*c(n,1)/h(n)^2;
r(n-1,p)= 6*c(n,1)/h(n)^2;
// rotational dof
r(p,p)=4*(c(n,1)/h(n)+b(n,1)/l(1));
r(p+1,p)=2*b(n,1)/l(1);
r(p-m-1,p)=2*c(n,1)/h(n);
// right node, j=m+1
// translation dof
p=n*(m+2);
r(n,p)= -6*c(n,m+1)/h(n)^2;
r(n-1,p)= 6*c(n,m+1)/h(n)^2;
// rotational dof
r(p,p)=4*(c(n,m+1)/h(n)+b(n,m)/l(m));
r(p-1,p)=2*b(n,m)/l(m);
r(p-m-1,p)=2*c(n,m+1)/h(n);
// right node, j=m+1
for j=2:m
p=n+(n-1)*(m+1)+j;
// translation dof
r(n,p)= -6*c(n,j)/h(n)^2;
r(n-1,p)= 6*c(n,j)/h(n)^2;
// rotational dof
r(p,p)=4*(c(n,j)/h(n)+b(n,j-1)/l(j-1)+b(n,j)/l(j));
r(p-1,p)=2*b(n,j-1)/l(j-1);
r(p+1,p)=2*b(n,j)/l(j);
r(p-m-1,p)=2*c(n,j)/h(n);
end
end
// stiffness from node rotation
// current floor
for i=2:n-1
// left node, j=1
p=n+(i-1)*(m+1)+1;
// lateral dof
r(i,p)=6*(-c(i,1)/h(i)^2+c(i+1,1)/h(i+1)^2);
r(i+1,p)=-6*c(i+1,1)/h(i+1)^2;
r(i-1,p)=6*c(i,1)/h(i)^2;
// rotational dof
r(p,p)=4*(c(i,1)/h(i)+c(i+1,1)/h(i+1)+b(i,1)/l(1));
r(p+1,p)=2*b(i,1)/l(1);
r(p-m-1,p)=2*c(i,1)/h(i);

r(p+m+1,p)=2*c(i+1,1)/h(i+1);
// right node, j=m+1
p=n+i*(m+1);
// lateral dof
r(i,p)=6*(-c(i,m+1)/h(i)^2+c(i+1,m+1)/h(i+1)^2);
r(i+1,p)=-6*c(i+1,m+1)/h(i+1)^2;
r(i-1,p)=6*c(i,m+1)/h(i)^2;
// rotational dof
r(p,p)=4*(c(i,m+1)/h(i)+c(i+1,m+1)/h(i+1)+b(i,m)/l(m));
r(p-1,p)=2*b(i,m)/l(m);
r(p-m-1,p)=2*c(i,m+1)/h(i);
r(p+m+1,p)=2*c(i+1,m+1)/h(i+1);
//current node
for j=2:m
p=n+(i-1)*(m+1)+j;
// lateral dof
r(i,p)=6*(-c(i,j)/h(i)^2+c(i+1,j)/h(i+1)^2);
r(i+1,p)=-6*c(i+1,j)/h(i+1)^2;
r(i-1,p)= 6*c(i,j)/h(i)^2;
// rotational dof
r(p,p)=4*(c(i,j)/h(i)+c(i+1,j)/h(i+1)+b(i,j-1)/l(j-1)+b(i,j)/l(j));
r(p-1,p)=2*b(i,j-1)/l(j-1);
r(p+1,p)=2*b(i,j)/l(j);
r(p-m-1,p)=2*c(i,j)/h(i);
r(p+m+1,p)=2*c(i+1,j)/h(i+1);
end
end
// verifying the symmetry
v=r-r';
vm=max(max(abs(v)));
disp(['maximum of the difference between simmetrical elements is ' +
string(vm)])
// calculation of the stiffness matrix
R11=r(1:n,1:n);
R12=r(1:n,(n+1):(n*(m+2)));
R21=r((n+1):(n*(m+2)),1:n);
R22=r((n+1):(n*(m+2)),(n+1):(n*(m+2)));
K=(R11-R12*inv(R22)*R21)*EI

Das könnte Ihnen auch gefallen