
function [x1 y1 z1] = rotx3(x,y,z,a);

% [x1 y1] = roty3(x,y,a);
% 
%performs a x,y,z rotation about (0,0,0)
%x, y and z coordinates
%a is rotation angle in deg
%note right handed sysytem

a = deg2rad(a);
i=length(a);
rnd=0; %round (1) or not(0)

%%%%  R = rotation Matrix about x axis %%%%%%%%%%%%%%%
R = zeros(3,3,i);
R(1,1,:)=1;  R(2,2,:)=cos(a);  R(3,2,:)=-sin(a); R(2,3,:)=sin(a);  R(3,3,:)=cos(a);

% Ri = zeros(3,3);
% Ri(1)=1;  Ri(5)=cos(a);  Ri(6)=-sin(a);
% Ri(8)=sin(a);  Ri(9)=cos(a);

%%%% C = is the input coordinates vector
C = [x y z ]';


P = R*C; 
if rnd,P=round(P.*1e14)./1e14;end
x1 = P(1); y1 = P(2);z1 = P(3);
