# geod2geoc

Convert geodetic latitude to geocentric latitude

## Syntax

```gc = geod2geoc(gd, h) gc = geod2geoc(gd, h, model) gc = geod2geoc(gd, h, f, Re) ```

## Description

`gc = geod2geoc(gd, h)` converts an array of `m` geodetic latitudes, `gd`, and an array of mean sea level altitudes, `h`, into an array of `m` geocentric latitudes, `gc`. `h` is in meters. Latitude values can be any value. However, values of +90 and -90 may return unexpected values because of singularity at the poles.

`gc = geod2geoc(gd, h, model)` is an alternate method for converting from geodetic to geocentric latitude for a specific ellipsoid planet. Currently only `'WGS84'` is supported for `model`. Latitude values can be any value. However, values of +90 and -90 may return unexpected values because of singularity at the poles.

`gc = geod2geoc(gd, h, f, Re)` is another alternate method for converting from geodetic to geocentric latitude for a custom ellipsoid planet defined by flattening, `f`, and the equatorial radius, `Re`, in meters. Latitude values can be any value. However, values of +90 and -90 may return unexpected values because of singularity at the poles.

## Examples

Determine geocentric latitude given a geodetic latitude and altitude:

```gc = geod2geoc(45, 1000) gc = 44.8076 ```

Determine geocentric latitude at multiple geodetic latitudes and altitudes, specifying WGS84 ellipsoid model:

```gc = geod2geoc([0 45 90], [1000 0 2000], 'WGS84') gc = 0 44.8076 90.0000```

Determine geocentric latitude at multiple geodetic latitudes, given an altitude and specifying custom ellipsoid model:

```f = 1/196.877360; Re = 3397000; gc = geod2geoc([0 45 90], 2000, f, Re) gc = 0 44.7084 90.0000```

## Assumptions and Limitations

This implementation generates a geocentric latitude that lies between ±90 degrees.

## Algorithms

The `geod2geoc` function converts a geodetic latitude (μ) into geocentric latitude (λ), where:

• λ — Geocentric latitude

• μ — Geodetic latitude

• h — Height from the surface of the planet

• f — Flattening

• a — Equatorial radius of the plant (semi-major axis) (`Re`)

Given the geodetic latitude (μ) and the height from the surface of the planet (h), this block first calculates the geometric properties of the planet.

`$\begin{array}{l}{e}^{2}=\frac{f}{\left(2-f\right)}\\ N=\frac{a}{\sqrt{1-{e}^{2}\mathrm{sin}{\left(\mu \right)}^{2}}\right)}.\end{array}$`

It then calculates the geocentric latitude from the point's distance from the polar axis (ρ) and distance from the equatorial axis (z).

`$\begin{array}{l}\rho =\left(N+h\right)\mathrm{sin}\left(\mu \right)\\ z=\left(N\left(1-{e}^{2}\right)+h\right)\mathrm{sin}\left(\mu \right)\\ \lambda ={\mathrm{tan}}^{-1}\left(\frac{z}{\rho }\right).\end{array}$`

## References

Stevens, B. L., and F. L. Lewis, Aircraft Control and Simulation, John Wiley & Sons, New York, NY, 1992