Home > atmlab > geodetic > geocentric2geodetic.m

geocentric2geodetic

PURPOSE ^

GEOCENTRIC2GEODETIC converts from a geocentric coordinate to a geodetic coordinate

SYNOPSIS ^

function [h,lat_gd,lon_gd]=geocentric2geodetic(r,lat_gc,lon_gc,ellipsoid)

DESCRIPTION ^

 GEOCENTRIC2GEODETIC converts from a geocentric coordinate to a geodetic coordinate
  
   The geodetic coordinates refer to the reference ellipsoid 
   specified by input ellipsoid. 
   See Contents for a defintion of the geocentric coordinate system.

 FORMAT [h,lat_gd,lon_gd]=geocentric2geodetic(r,lat_gc,lon_gc[,ellipsoid])

 OUT    h         Geodetic height (height above the reference ellipsoid)
        lat_gd    Geodetic latitude
        lon_gd    geodetic longitude

 IN     r         Radius
        lat_gc    Geocentric latitude
        lon_gc    Geocentric longitude
 OPT    ellipsoid a row vector with the form [semimajor axis, eccentricity]
                  specifying the ellipsoid,
                  the semimajor axis must use the same units as r  
        Default is WGS84.

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

DOWNLOAD ^

geocentric2geodetic.m

SOURCE CODE ^

0001 % GEOCENTRIC2GEODETIC converts from a geocentric coordinate to a geodetic coordinate
0002 %
0003 %   The geodetic coordinates refer to the reference ellipsoid
0004 %   specified by input ellipsoid.
0005 %   See Contents for a defintion of the geocentric coordinate system.
0006 %
0007 % FORMAT [h,lat_gd,lon_gd]=geocentric2geodetic(r,lat_gc,lon_gc[,ellipsoid])
0008 %
0009 % OUT    h         Geodetic height (height above the reference ellipsoid)
0010 %        lat_gd    Geodetic latitude
0011 %        lon_gd    geodetic longitude
0012 %
0013 % IN     r         Radius
0014 %        lat_gc    Geocentric latitude
0015 %        lon_gc    Geocentric longitude
0016 % OPT    ellipsoid a row vector with the form [semimajor axis, eccentricity]
0017 %                  specifying the ellipsoid,
0018 %                  the semimajor axis must use the same units as r
0019 %        Default is WGS84.
0020 
0021 % History: created by Bengt Rydberg 2011-10-31
0022 function [h,lat_gd,lon_gd]=geocentric2geodetic(r,lat_gc,lon_gc,ellipsoid)
0023 
0024 if nargin<4
0025    %WGS84 reference ellipsoid
0026   ellipsoid = ellipsoidmodels( 'WGS84' );
0027 end 
0028 
0029 [x,y,z]           = geocentric2cart(r,lat_gc,lon_gc);
0030 
0031 [h,lat_gd,lon_gd] = cart2geodetic(x,y,z,ellipsoid);
0032

Generated on Mon 15-Sep-2014 13:31:28 by m2html © 2005