LATLON2XYZ Converts latitude and longitude into 3D Cartesian coordinates. [X,Y,Z]=LATLON2XYZ(LAT,LON) converts latitude and longitude of a position on the surface of a sphere into Cartesian coordinates. LAT and LON are in degrees and X, Y, and Z are in kilometers. LAT and LON may either be arrays of the same size, or LON may be an array and LAT a scalar. X, Y, and Z will have the same size as LON. The Cartesian coordinate system is a right-handed system whose origin lies at the center of the sphere. It is oriented with the Z-axis passing through the poles and the X-axis passing through the point LAT=0, LON=0. By default, the radius of the sphere is taken as RADEARTH. LATLON2XYZ(LAT,LON,R) uses a sphere of radius R, in kilometers, instead. LATLON2XYZ is inverted by XYZ2LATLON. See JSPHERE for related functions. 'latlon2xyz --t' runs a test. Usage: [x,y,z]=latlon2xyz(lat,lon); [x,y,z]=latlon2xyz(lat,lon,R); __________________________________________________________________ This is part of JLAB --- type 'help jlab' for more information (C) 2006--2014 J.M. Lilly --- type 'help jlab_license' for details