Main Content


Cross-fix positions from bearings and ranges


[newlat,newlon] = crossfix(lat,lon,az)
[newlat,newlon] = crossfix(lat,lon,az_range,case)
[newlat,newlon] = crossfix(lat,lon,az_range,case,drlat,drlon)
[newlat,newlon] = crossfix(lat,lon,az,units)
[newlat,newlon] = crossfix(lat,lon,az_range,case,units)
[newlat,newlon] = crossfix(lat,lon,az_range,drlat,drlon,units)
[newlat,newlon] = crossfix(lat,lon,az_range,case,drlat,drlon,units)
mat = crossfix(...)


[newlat,newlon] = crossfix(lat,lon,az) returns the intersection points of all pairs of great circles passing through the points given by the column vectors lat and lon that have azimuths az at those points. The outputs are two-column matrices newlat and newlon in which each row represents the two intersections of a possible pairing of the input great circles. If there are n input objects, there will be n choose 2 pairings.

[newlat,newlon] = crossfix(lat,lon,az_range,case) allows the input az_range to specify either azimuths or ranges. Where the vector case equals 1, the corresponding element of az_range is an azimuth; where case is 0, az_range is a range. The default value of case is a vector of ones (azimuths).

[newlat,newlon] = crossfix(lat,lon,az_range,case,drlat,drlon) resolves the ambiguities when there is more than one intersection between two objects. The scalar-valued drlat and drlon provide the location of an estimated (dead reckoned) position. The outputs newlat and newlon are column vectors in this case, returning only the intersection closest to the estimated point. When this option is employed, if any pair of objects fails to intersect, no output is returned and the warning No Fix is displayed.

[newlat,newlon] = crossfix(lat,lon,az,units), [newlat,newlon] = crossfix(lat,lon,az_range,case,units), [newlat,newlon] = crossfix(lat,lon,az_range,drlat,drlon,units), and [newlat,newlon] = crossfix(lat,lon,az_range,case,drlat,drlon,units) allow the specification of the angle units to be used for all angles and ranges, where units is any valid angle units value. The default value of units is 'degrees'.

mat = crossfix(...) returns the output in a two- or four-column matrix mat.

This function calculates the points of intersection between a set of objects taken in pairs. Given great circle azimuths and/or ranges from input points, the locations of the possible intersections are returned. This is different from the navigational function navfix in that crossfix uses great circle measurement, while navfix uses rhumb line azimuths and nautical mile distances.


collapse all

This example shows how to find the intersection of points on circles.

Create map axes.

ha = axesm('mapproj','mercator', ...
    'maplatlim',[-10 15],'maplonlim',[-10 20],...
axis off
gridm on
framem on
mlabel on
plabel on

Define latitudes and longitudes of three arbitrary points, and then define three radii, all 8 degrees.

latpts = [0;5;0];           
lonpts = [0;5;10];     
radii = [8;8;8];

Obtain the intersections of imagined small circles around these points.

[newlat,newlon] = crossfix(latpts,lonpts,radii,[0;0;0])
newlat = 3×2

    7.5594   -2.5744
    6.2529   -6.2529
    7.5594   -2.5744

newlon = 3×2

   -2.6260    7.5770
    5.0000    5.0000
   12.6260    2.4230

Draw red circle markers at the given points.


Draw magenta diamond markers at the points of intersection.


Generate a small circle 8 deg radius for each original point.

[latc1,lonc1] = scircle1(latpts(1),lonpts(1),radii(1));
[latc2,lonc2] = scircle1(latpts(2),lonpts(2),radii(2));
[latc3,lonc3] = scircle1(latpts(3),lonpts(3),radii(3));

Plot the small circles to show the intersections are as determined.


Find intersection when a dead reckoning position is provided, (0º,5ºE). crossfix returns one from each pair (the closest one).

[newlat,newlon] = crossfix([0 5 0]',[0 5 10]',...
                            [8 8 8]',[0 0 0]',0,5)
newlat =


newlon =


Version History

Introduced before R2006a