function [ker,fer] = rotateDOF(iele,nnpe,np,nangle,ke,fe)
% rotate elemental matrices from global to local coordinates for bc's

% find sine, cosine of angle
for  k=1:nnpe
  k1=np(iele,k);
  teta=nangle(k1);
  s(k)=sin(teta);
  c(k)=cos(teta);
end

% define direction cosine matrix [a]
a=[ c(1),s(1),    0,   0,    0,   0;
   -s(1),c(1),    0,   0,    0,   0;
       0,   0, c(2),s(2),    0,   0;
       0,   0,-s(2),c(2),    0,   0;
       0,   0,    0,   0, c(3),s(3);
       0,   0,    0,   0,-s(3),c(3)];

% rotate ke by [a]:  
ker=a*ke*a';

% rotate fe by [a]: 
fer=a*fe;
