Given the position vector R of a satellite in a geocentric equatorial frame.In this Example we will show how to calculate the right ascension and declination.
clear all; clc; R = [-5239 1989 4581]; % Position vector r = norm(R); l = R(1)/r; m = R(2)/r; n =R(3)/r; % Direction cosines delta = asin(n)*180/pi; % Declination % Right ascension: if (m >0) alfa = acos(l/cosd(delta))*180/pi; else alfa = 360 - acos(l/cosd(delta))*180/pi; end fprintf('Right ascension = %4.2f [deg] \n',alfa); fprintf('Declination = %4.2f [deg] \n',delta);
Right ascension = 159.21 [deg] Declination = 39.27 [deg]
How would you do it in reverse? Get the unit position vector from the right ascention and declination?
I think this post shall be helpful
https://smallsats.org/2013/01/17/state-vectors-r-v-from-orbital-elements/