www.gusucode.com > gps卫星位置预报,MATLAB编写,有动画界面源码程序 > code5/gps_final_new/llh2xyz.m

    function [x,y,z]=llh2xyz(lat,lon,height)

a=6378137.0;
b=6356752.314;
n=a*a/sqrt(a*a*cos(lat)*cos(lat)+b*b*sin(lat)*sin(lat));
x=(n+height)*cos(lat)*cos(lon);
y=(n+height)*cos(lat)*sin(lon);
z=(b*b/(a*a)*n+height)*sin(lat);