function rotatemat = rotate(Element,theta) RotateMat= [cos(theta), -sin(theta); sin(theta), cos(theta)]; rotatemat=Element; for i=1:3:size(Element,1) rotatemat(i:(i+1),:)=RotateMat*Element(i:(i+1),:); end end