Code covered by the BSD License
 anmp (a)
 celpol (tjd, itype, dpole...this function allows for the specification of celestial pole
 celter (tjdh, tjdl, xp, y...this function rotates a vector from the celestial to the
 ciobas (tjd, racio, k)
this function returns the orthonormal basis vectors, with
 cioloc (tjd)
this function returns the location of the celestial
 ciotio
 eect2000 (date1, date2)
equation of the equinoxes complementary terms, consistent with
 eqinox
 eqxra (tjd, k)
this function computes the intermediate right ascension
 erot (date1, date2)
this function returns the value of the earth rotation angle
 etilt (tjd)
this function computes quantities related to the orientation
 frame (pos1, k)
this function transforms a vector from the dynamical reference
 funarg (t)
this function computes fundamental arguments (mean elements)
 gdate (jdate)
convert Julian date to Gregorian (calendar) date
 getdt
this entry returns the current value of deltat
 getmod
this function returns the 'mode' value, which
 hiacc
 jd2str(jdate)
convert Julian date to string equivalent
 loacc
 nod (t)
this function returns the values for nutation in longitude and
 novas_times (tdbjd)
this function computes the terrestrial time (tt) julian date
 nut2000a (date1, date2)
nutation based on iau 2000a theory
 nut2000k (date1, date2)
nutation based on the iau 2000k theory
 nutate (tjd, pos1)
this function nutates equatorial rectangular coordinates from
 obliq(t)
function to compute mean obliquity of the ecliptic in arcseconds
 preces (tjd1, pos1, tjd2)
this function precesses equatorial rectangular coordinates from
 resume
 setdt (delt)
this function allows for the specification of the deltat value
 setmod (mode)
this function allows the user to specify the 'mode' value,
 sidtim (tjdh, tjdl, k)
this function computes the greenwich sidereal time
 spin (angl, pos1)
this function transforms a vector from one coordinate system
 tercel (tjdh, tjdl, xp, y...this function rotates a vector from the terrestrial to the
 wobble (tjd, x, y, pos1)
this function corrects a vector in the itrs (a rotating earth
 demo_tercel.m

View all files
A MATLAB Script for Terrestrial and Celestial Coordinate Conversion
by
David Eagle
18 Jan 2013
MATLAB functions and script for performing terrestrial to/from celestial coordinate transformations.

frame (pos1, k)

function pos2 = frame (pos1, k)
% this function transforms a vector from the dynamical reference
% system to the international celestial reference system (icrs),
% or vice versa. the dynamical reference system is based on the
% dynamical mean equator and equinox of j2000.0. the icrs is
% based on the spacefixed icrs axes defined by the radio catalog
% positions of several hundred extragalactic objects. the rotation
% matrix used here is equivalent to that given by hilton and
% hohenkerk (2004), astronomy and astrophysics 413, 765770,
% eq. (6) and (8).
% input
% pos1 = position vector, equatorial rectangular coordinates
% k = direction of rotation
% set k < 0 for dynamical to icrs
% set k > 0 for icrs to dynamical
% output
% pos2 = position vector, equatorial rectangular coordinates
% note: for geocentric coordinates, the same transformation is
% used between the dynamical reference system and the gcrs.
% ported from NOVAS 3.0
%%%%%%%%%%%%%%%%%%%%%%%
seccon = 180.d0 * 3600.d0 / pi;
% xi0, eta0, and da0 are icrs frame biases in arcseconds taken
% from iers conventions (2003), chapter 5
xi0 = 0.0166170d0;
eta0 = 0.0068192d0;
da0 = 0.01460d0;
% compute elements of rotation matrix (to first order)
xx = 1.0d0;
yx = da0 / seccon;
zx = xi0 / seccon;
xy = da0 / seccon;
yy = 1.0d0;
zy = eta0 / seccon;
xz = xi0 / seccon;
yz = eta0 / seccon;
zz = 1.0d0;
% include secondorder corrections to diagonal elements
xx = 1.0d0  0.5d0 * (yx^2 + zx^2);
yy = 1.0d0  0.5d0 * (yx^2 + zy^2);
zz = 1.0d0  0.5d0 * (zy^2 + zx^2);
if (k >= 0)
% perform rotation from icrs to dynamical system
pos2(1) = xx * pos1(1) + xy * pos1(2) + xz * pos1(3);
pos2(2) = yx * pos1(1) + yy * pos1(2) + yz * pos1(3);
pos2(3) = zx * pos1(1) + zy * pos1(2) + zz * pos1(3);
else
% perform rotation from dynamical system to icrs
pos2(1) = xx * pos1(1) + yx * pos1(2) + zx * pos1(3);
pos2(2) = xy * pos1(1) + yy * pos1(2) + zy * pos1(3);
pos2(3) = xz * pos1(1) + yz * pos1(2) + zz * pos1(3);
end


Contact us