function [x,y,z]=g2e(phi,lamdac,h)
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% filename g2e.m
% G2E   Geodetic coordinates to earth-centered cartesian coordinates conversion.
% [x,y,z]=g2e(phi,lamdac,h) gives 
% x, y and z : ECI cartesian position coordinates (km)
% corresponding to 
% phi : geodetic latitude (rad),
% lamdac : celestial longitude (rad) and 
% h : altitude normal to ellipsoid (ft).
% User can change the unit of length replacing the value of "a", such as
% a=6378.137;         %(km)
% a=6378137;          %(m)
% a=20925646.3254593; %(ft)
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
a=20925646.3254593; %(ft)
e2=0.00669437999;
b=a*sqrt(1-e2);
r=a/sqrt(1-e2*(sin(phi))^2);
x=(r+h)*cos(phi)*cos(lamdac);
y=(r+h)*cos(phi)*sin(lamdac);
z=((1-e2)*r+h)*sin(phi);
%end of file
