function mat=rot(ra, dec) Return the rotation matrix to convert from a coordinate system centered on a given pointing position, to a coordinate system with X aligned with RA=0h, Y aligned with RA=6h, Z aligned with the NCP Inputs: ra - The right acension, in radians dec - The declination, in radians
0001 function mat=rot(ra, dec) 0002 0003 % function mat=rot(ra, dec) 0004 % 0005 % Return the rotation matrix to convert from a coordinate system 0006 % centered on a given pointing position, to a coordinate system with 0007 % X aligned with RA=0h, Y aligned with RA=6h, Z aligned with the NCP 0008 % 0009 % Inputs: 0010 % 0011 % ra - The right acension, in radians 0012 % 0013 % dec - The declination, in radians 0014 0015 0016 cr = cos(ra); 0017 sr = sin(ra); 0018 0019 cd = cos(dec); 0020 sd = sin(dec); 0021 0022 rotr = [cr, -sr, 0; sr, cr, 0; 0, 0, 1]; 0023 rotd = [sd, 0, cd; 0, 1, 0; -cd, 0, sd]; 0024 0025 mat = rotr*rotd; 0026 0027 return 0028