Accelerating the pace of engineering and science

ellipse1

Geographic ellipse from center, semimajor axes, eccentricity, and azimuth

Syntax

[lat,lon] = ellipse1(lat0,lon0,ellipse)
[lat,lon] = ellipse1(lat0,lon0,ellipse,offset)
[lat,lon] = ellipse1(lat0,lon0,ellipse,offset,az)
[lat,lon] = ellipse1(lat0,lon0,ellipse,offset,az,ellipsoid)
[lat,lon] = ellipse1(___,angleUnit)
[lat,lon] = ellipse1(lat0,lon0,ellipse,offset,az,ellipsoid,angleUnit,npts)
[lat,lon] = ellipse1(trackStr,...)
mat = ellipse1(...)

Description

[lat,lon] = ellipse1(lat0,lon0,ellipse) computes ellipse(s) with center(s) at lat0,lon0. The ellipse is defined by the third input, which is of the form [semimajor axis,eccentricity], where the eccentricity input can be a two-element row vector or a two-column matrix. The ellipse input must have the same number of rows as the input scalar or column vectors lat0 and lon0. The input semimajor axis is in degrees of arc length on a sphere. All ellipses are oriented so that their major axes run north-south.

[lat,lon] = ellipse1(lat0,lon0,ellipse,offset) computes the ellipse(s) where the major axis is rotated from due north by an azimuth offset. The offset angle is measured clockwise from due north. If offset = [], then no offset is assumed.

[lat,lon] = ellipse1(lat0,lon0,ellipse,offset,az) uses the input az to define the ellipse arcs computed. The arc azimuths are measured clockwise from due north. If az is a column vector, then the arc length is computed from due north. If az is a two-column matrix, then the ellipse arcs are computed starting at the azimuth in the first column and ending at the azimuth in the second column. If az = [], then a complete ellipse is computed.

[lat,lon] = ellipse1(lat0,lon0,ellipse,offset,az,ellipsoid) computes the ellipse on the ellipsoid defined by the input ellipsoid. ellipsoid is a referenceSphere, referenceEllipsoid, or oblateSpheroid object, or a vector of the form [semimajor_axis eccentricity]. If omitted, the unit sphere, is assumed. When an ellipsoid is supplied, the input semimajor axis must be in the same units as the ellipsoid semimajor axes. In this calling form, the units of the ellipse semimajor axis are not assumed to be in degrees.

[lat,lon] = ellipse1(___,angleUnit) where angleUnit defines the units of the inputs and outputs. angleUnit can be 'degrees' or 'radians'. If the angleUnit string is omitted, 'degrees' is assumed.

[lat,lon] = ellipse1(lat0,lon0,ellipse,offset,az,ellipsoid,angleUnit,npts) uses the scalar npts to determine the number of points per ellipse computed. If npts is omitted, 100 points are used.

[lat,lon] = ellipse1(trackStr,...) uses the trackStr string to define either great circle or rhumb line distances from the ellipse center. If trackStr = 'gc', then great circle distances are computed (the default). If trackStr = 'rh', then rhumb line distances are computed.

mat = ellipse1(...) returns a single output argument where mat = [lat lon]. This is useful if only one ellipse is computed.

You can define multiple ellipses with a common center by providing scalar lat0 and lon0 inputs and a two-column ellipse matrix.

Examples

Create and plot the small ellipse centered at (0º,0º), with a semimajor axis of 10º and a semiminor axis of 5º.

```axesm mercator
ecc = axes2ecc(10,5);
plotm(0,0,'r+')
[elat,elon] = ellipse1(0,0,[10 ecc],45);
plotm(elat,elon)```

If the desired radius is known in some nonangular distance unit, use the radius returned by the earthRadius function as the ellipsoid input to set the range units. (Use an empty azimuth entry to specify a full ellipse.)

```[elat,elon] = ellipse1(0,0,[550 ecc],45,[],earthRadius('nm'));
plotm(elat,elon,'m--')```

For just an arc of the ellipse, enter an azimuth range:

```[elat,elon] = ellipse1(0,0,[5 ecc],45,[-30 70]);
plotm(elat,elon,'c-')```