Home > atmlab > geodetic > ellipsoidradii2.m

ellipsoidradii2

PURPOSE ^

ELLIPSOIDRADII Different geodetic radii of a reference ellipsoid

SYNOPSIS ^

function r = ellipsoidradii2(ellipsoid,lat_gd)

DESCRIPTION ^

 ELLIPSOIDRADII   Different geodetic radii of a reference ellipsoid

    The calculation expressions are taken from radiigeo.pdf, found in the
    same folder as this function.

    Please note that geoDETIC latitudes are used. Use *ellipsoidradii* for
    geocentric latitudes.

 FORMAT   r = ellipsoidradii( ellipsoid, lat_gd )
    
 OUT   r          Radii. See above.
 IN    ellipsoid  Model ellipsoid as returned by *ellipsoidmodels*.
       lat_gd     Geodetic latitudes.

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

DOWNLOAD ^

ellipsoidradii2.m

SOURCE CODE ^

0001 % ELLIPSOIDRADII   Different geodetic radii of a reference ellipsoid
0002 %
0003 %    The calculation expressions are taken from radiigeo.pdf, found in the
0004 %    same folder as this function.
0005 %
0006 %    Please note that geoDETIC latitudes are used. Use *ellipsoidradii* for
0007 %    geocentric latitudes.
0008 %
0009 % FORMAT   r = ellipsoidradii( ellipsoid, lat_gd )
0010 %
0011 % OUT   r          Radii. See above.
0012 % IN    ellipsoid  Model ellipsoid as returned by *ellipsoidmodels*.
0013 %       lat_gd     Geodetic latitudes.
0014 
0015 % 2011-11-14   Created by Patrick Eriksson.
0016 
0017 
0018 function r = ellipsoidradii2(ellipsoid,lat_gd)
0019 
0020 % Check input                                                          %&%
0021 rqre_datatype( ellipsoid, @isvector );                                 %&%
0022 if length(ellipsoid) ~= 2                                              %&%
0023  error( 'The argument *ellipsoid* must be a vector of length 2' );     %&%
0024 end                                                                    %&%
0025 rqre_in_range( ellipsoid(2), 0, 1, 'element 2 of ellipsoid' );         %&%
0026 rqre_datatype( lat_gd, @isnumeric );                                   %&%
0027 
0028 
0029 % Spherical case (all radii the same)
0030 if ellipsoid(2) == 0
0031   %
0032   r = repmat( ellipsoid(1), size(lat_gd) );
0033 
0034 % The actual radius
0035 else
0036   %
0037   e2   = ellipsoid(2)^2;
0038   sin2 = sind(lat_gd).^2;
0039   %
0040   r = ellipsoid(1) * sqrt((1-e2).^2*sin2+cosd(lat_gd).^2) ./ sqrt(1-e2*sin2);
0041 
0042 end

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