Home > atmlab > geophysics > pos2g.m

pos2g

PURPOSE ^

POS2G Earth's gravitational constant

SYNOPSIS ^

function g = pos2g( lat, z )

DESCRIPTION ^

 POS2G   Earth's gravitational constant

    Returns g as a function of latitude and altitude.

 FORMAT   g = pos2g( lat [, z] )
        
 OUT   g     Gravitational constant
 IN    lat   Latitude(s).
 OPT   z     Altitude(s). Default 0 m.

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

DOWNLOAD ^

pos2g.m

SOURCE CODE ^

0001 % POS2G   Earth's gravitational constant
0002 %
0003 %    Returns g as a function of latitude and altitude.
0004 %
0005 % FORMAT   g = pos2g( lat [, z] )
0006 %
0007 % OUT   g     Gravitational constant
0008 % IN    lat   Latitude(s).
0009 % OPT   z     Altitude(s). Default 0 m.
0010 
0011 % 2006-12-06   Created by Patrick Eriksson.
0012 
0013 
0014 function g = pos2g( lat, z )
0015   
0016 if any( lat<-90 )  |  any( lat>90 )
0017   error( 'Only latitudes inside [-90,90] are allowed.' );
0018 end
0019 
0020 if nargin < 2
0021   z = 0;
0022 elseif any( z<-1e3 )  |  any( z>1000e3 )
0023   error( 'Only altitudes inside [-1,1000] km are allowed.' );  
0024 end
0025   
0026 
0027 lat = constants('DEG2RAD') * lat;
0028 
0029  
0030 % Expression found on web page of UK's National Physical Laboratory
0031 
0032 g = 9.780327 * ( 1 + 0.0053024*sin(lat).^2 - 0.0000058*sin(2*lat).^2) - ...
0033                                                                    3.086e-6*z;

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