Work with Reference Spheroids
Reference spheroids are needed in three main contexts: map projections, curves and areas on the surface of a spheroid, and 3-D computations involving geodetic coordinates.
Map Projections
You can set the value of the Geoid property of a new
          axesm-based map (which is actually a Spheroid property) using any
        type of reference spheroid representation. Except in the case of UTM and UPS, the default
        value is an ellipsoid vector representing the unit sphere: [1 0]. It is
        also the default value when using the worldmap and usamap functions.
You can reset the Geoid property of an existing
          axesm-based map to any type of reference spheroid representation by
        using setm. For example, worldmap
        always sets up a projection based on the unit sphere but you can subsequently use
          setm to switch to the spheroid of your choice. To set up a map of North
        America for use with Geodetic Reference System 1980, for instance, follow
          worldmap with a call to setm, like this:
ax = worldmap('North America'); setm(ax,'geoid',referenceEllipsoid('grs80'))
When projecting or unprojecting data without an axesm-based map,
        you can set the geoid field of a map projection structure
          (mstruct) to any type of reference spheroid representation. Remember to
        follow all mstruct updates with a second call to defaultm to ensure that all properties are set to legitimate values. For
        example, to use the Miller projection with WGS 84 in kilometers, start with:
mstruct = defaultm('miller'); mstruct.geoid = wgs84Ellipsoid('km'); mstruct = defaultm(mstruct);
You can inspect the mstruct to ensure that you are indeed using the
        WGS 84 ellipsoid:
mstruct.geoid
ans = 
referenceEllipsoid with defining properties:
                 Code: 7030
                 Name: 'World Geodetic System 1984'
           LengthUnit: 'kilometer'
        SemimajorAxis: 6378.137
        SemiminorAxis: 6356.75231424518
    InverseFlattening: 298.257223563
         Eccentricity: 0.0818191908426215
  and additional properties:
    Flattening
    ThirdFlattening
    MeanRadius
    SurfaceArea
    VolumeSee axesm-Based Map Properties for definitions of the fields found in
          mstructs.
Curves and Areas
Another important context in which reference spheroids appear is the computation of
        curves and areas on the surface of a sphere or oblate spheroid. The distance function, for example, assumes a sphere by default, but accepts a
        reference spheroid as an optional input. distance is used to compute the
        length of the geodesic or rhumb line arc between a pair of points with given latitudes and
        longitudes. If a reference spheroid is provided through the ellipsoid
        argument, then the unit used for the arc length output matches the
          LengthUnit property of the spheroid.
Other functions for working with curves and areas that accept reference spheroids
        include reckon, scircle1, scircle2, ellipse1, track1, track2, and areaquad, to name just a few. When using such
        functions without their ellipsoid argument, be sure to check the
        individual function help if you are unsure about which reference spheroid is assumed by
        default.
3-D Coordinate Transformations
The third context in which reference spheroids frequently appear is the transformation
        of geodetic coordinates (latitude, longitude, and height above the ellipsoid) to other
        coordinate systems. For example, the geodetic2ecef function, which converts point locations from a geodetic system
        to a geocentric (Earth-Centered Earth-Fixed) Cartesian system, requires a reference spheroid
        object (or an ellipsoid vector) as input.