
function [x1 y1 z1] = roty3(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 y axis %%%%%%%%%%%%%%%
R = zeros(3,3,i);
R(1,1,:)=cos(a);  R(3,1,:)=-sin(a);  R(2,2,:)=1; R(1,3,:)=sin(a);  R(3,3,:)=cos(a);


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

%%% try mtimesx n-D matrix multiplication
% addpath ~/Documents/MATLAB/work/general/mtimesx_20110223/
% P = mtimesx(R,C)
P = R*C;

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