function [b1Rot, b2Rot, b3Rot] = autoRot(b1Rot,b2Rot,b3Rot)
R=zeros(3,3);
R(:,1)=b1Rot;
R(:,2)=b2Rot;
R(:,3)=b3Rot;
A = inv(R);
theta = asin(A(1,3));
psi = atan2(-A(1,2),A(1,1));
phi = atan2(-A(2,3),A(3,3));
a1 = b1Rot; a2 = b2Rot; a3 = b3Rot;
% Gesamtrotation läuft als Animation ab
% Dazu werden die einzelnen Rotationen in Teilrotationen
% zerlegt
nFrames=100;
moviein(3*nFrames);
for i=1:nFrames
    [b1Rot,b2Rot,b3Rot] = rotZ(b1Rot,b2Rot,b3Rot,psi/nFrames);
    rotationsachse = 'z';
    draw;
    M(:,i)=getframe;
end
for i=1:nFrames
    [b1Rot,b2Rot,b3Rot] = rotY(b1Rot,b2Rot,b3Rot,theta/nFrames);
    rotationsachse = 'y';
    draw;
    M(:,i+nFrames)=getframe;
end
for i=1:nFrames
    [b1Rot,b2Rot,b3Rot] = rotX(b1Rot,b2Rot,b3Rot,phi/nFrames);
    rotationsachse = 'x';
    draw;
    M(:,i+2*nFrames)=getframe;
end
