------------------------------------------------------------------------------ parallactic_angle function ephem Description: Calculate the parallactic angle of an object. The parallactic is defined as the angle between the local zenith, the object and the celestial north pole measured westwerd (e.g., negative before, and positive after the passage through the southern meridian). Input : * Set of three input argument: [RA, Dec], LST, Lat or alternatively four input argument: RA, Dec, LST, Lat. Where RA, Dec and Lat are in radians, and LST in fraction of days. Lat is observer the geodetic latitude. LST can be either a scalar, matrix of the same size as RA and Dec, or a vector which have a common dimension as RA and Dec. Output : - Parallactic angle If object in the zenith then NaN. Tested : Matlab 5.3 By : Eran O. Ofek October 2001 URL : http://wise-obs.tau.ac.il/~eran/matlab.html Reliable: 1 ------------------------------------------------------------------------------
0001 function [PA]=parallactic_angle(varargin) 0002 %------------------------------------------------------------------------------ 0003 % parallactic_angle function ephem 0004 % Description: Calculate the parallactic angle of an object. 0005 % The parallactic is defined as the angle between the local 0006 % zenith, the object and the celestial north pole measured 0007 % westwerd (e.g., negative before, and positive after the 0008 % passage through the southern meridian). 0009 % Input : * Set of three input argument: [RA, Dec], LST, Lat 0010 % or alternatively four input argument: RA, Dec, LST, Lat. 0011 % Where RA, Dec and Lat are in radians, and LST in 0012 % fraction of days. Lat is observer the geodetic latitude. 0013 % LST can be either a scalar, matrix of the same size as 0014 % RA and Dec, or a vector which have a common dimension 0015 % as RA and Dec. 0016 % Output : - Parallactic angle 0017 % If object in the zenith then NaN. 0018 % Tested : Matlab 5.3 0019 % By : Eran O. Ofek October 2001 0020 % URL : http://wise-obs.tau.ac.il/~eran/matlab.html 0021 % Reliable: 1 0022 %------------------------------------------------------------------------------ 0023 0024 if (length(varargin)==3), 0025 Coo = varargin{1}; 0026 LST = varargin{2}; 0027 Lat = varargin{3}; 0028 0029 RA = Coo(:,1); 0030 Dec = Coo(:,2); 0031 else 0032 RA = varargin{1}; 0033 Dec = varargin{2}; 0034 LST = varargin{3}; 0035 Lat = varargin{4}; 0036 end 0037 %HA = 2.*pi.*LST - RA; 0038 HA = bsxfun(@minus,2.*pi.*LST,RA); 0039 0040 TanQ = sin(HA)./(tan(Lat).*cos(Dec) - sin(Dec).*cos(HA)); 0041 PA = atan(TanQ);