Main Content

rangeangle

Range and angle calculation

Description

The function rangeangle determines the propagation path length and path direction of a signal from a source point or set of source points to a reference point. The function supports two propagation models – the free space model and the two-ray model. The free space model is a single line-of-sight path from a source point to a reference point. The two-ray multipath model generates two paths. The first path follows the free-space path. The second path is a reflected path off a boundary plane at z = 0. Path directions are defined with respect to either the global coordinate system at the reference point or a local coordinate system at the reference point. Distances and angles at the reference point do not depend upon which direction the signal is travelling along the path.

[rng,ang] = rangeangle(pos) returns the propagation path length, rng, and direction angles, ang, of a signal path from a source point or set of source points, pos, to the origin of the global coordinate system. The direction angles are the azimuth and elevation with respect to the global coordinate axes at the origin. Signals follow a line-of-sight path from the source point to the origin. The line-of-sight path corresponds to the geometric straight line between the points.

example

[rng,ang] = rangeangle(pos,refpos) also specifies a reference point or set of reference points, refpos. rng now contains the propagation path length from the source points to the reference points. The direction angles are the azimuth and elevation with respect to the global coordinate axes at the reference points. You can specify multiple points and multiple reference points.

example

[rng,ang] = rangeangle(pos,refpos,refaxes) also specifies local coordinate system axes, refaxes, at the reference points. Direction angles are the azimuth and elevation with respect to the local coordinate axes centered at refpos.

example

[rng,ang] = rangeangle(___,model), also specifies a propagation model. When model is set to "freespace", the signal propagates along a line-of-sight path from source point to reception point. When model is set to "two-ray", the signal propagates along two paths from source point to reception point. The first path is the line-of-sight path. The second path is the reflecting path. In this case, the function returns the distances and angles for two paths for each source point and corresponding reference point.

Examples

collapse all

Compute the range and angle of a target located at (1000,2000,50) meters from the origin.

TargetLoc = [1000;2000;50];
[tgtrng,tgtang] = rangeangle(TargetLoc)
tgtrng = 
2.2366e+03
tgtang = 2×1

   63.4349
    1.2810

Compute the range and angle of a target located at (1000,2000,50) meters with respect to a local origin at (100,100,10) meters.

TargetLoc = [1000;2000;50];
Origin = [100;100;10];
[tgtrng,tgtang] = rangeangle(TargetLoc,Origin)
tgtrng = 
2.1028e+03
tgtang = 2×1

   64.6538
    1.0900

Compute the range and angle of a target located at (1000,2000,50) meters but with respect to a local coordinate system origin at (100,100,10) meters. Choose a local coordinate reference frame that is rotated about the z-axis by 45° from the global coordinate axes.

targetpos = [1000;2000;50];
origin = [100;100;10];
refaxes = [1/sqrt(2) -1/sqrt(2) 0; 1/sqrt(2) 1/sqrt(2) 0; 0 0 1];
[tgtrng,tgtang] = rangeangle(targetpos,origin,refaxes)
tgtrng = 
2.1028e+03
tgtang = 2×1

   19.6538
    1.0900

Input Arguments

collapse all

Source point position in meters, specified as a real-valued 3-by-1 vector or a real-valued 3-by-N matrix. A matrix represents multiple source points. The columns contain the Cartesian coordinates of N points in the form [x;y;z].

When pos is a 3-by-N matrix, you must specify refpos as a 3-by-N matrix for N reference positions. If all the reference points are identical, you can specify refpos by a single 3-by-1 vector.

Example: [1000;2000;50]

Data Types: double

Reference point position in meters, specified as a real-valued 3-by-1 vector or a real-valued 3-by-N matrix. A matrix represents multiple reference points. The columns contain the Cartesian coordinates of N points ins the form [x;y;z].

When refpos is a 3-by-N matrix, you must specify pos as a 3-by-N matrix for N source positions. If all the source points are identical, you can specify pos by a single 3-by-1 vector.

Position units are meters.

Example: [100;100;10]

Data Types: double

Local coordinate system axes, specified as a real-valued 3-by-3 matrix or a 3-by-3-by-N array. For an array, each page corresponds to a local coordinate axes at each reference point. The columns in refaxes specify the direction of the coordinate axes for the local coordinate system in Cartesian coordinates. N must match the number of columns in pos or refpos when these dimensions are greater than one.

Example: rotz(45)

Data Types: double

Propagation model, specified as "freespace" or "two-ray". Choosing "freespace" invokes the free space propagation model. Choosing "two-ray" invokes the two-ray propagation model.

Data Types: char | string

Output Arguments

collapse all

Propagation range in meters, returned as a real-valued 1-by-N vector or real-valued 1-by-2N vector.

  • When model is set to "freespace", the size of rng is 1-by-N. The propagation range is the length of the direct path from the position defined in pos to the corresponding reference position defined in refpos.

  • When model is set to "two-ray", rng contains the ranges for the direct path and the reflected path. Alternate columns of rng refer to the line-of-sight path and reflected path, respectively for the same source-reference point pair.

Azimuth and elevation angles, in degrees, returned as a 2-by-N matrix or 2-by-2N matrix. Each column represents a direction angle in the form [azimuth;elevation].

  • When model is set to "freespace", ang is a 2-by-N matrix and represents the angle of the path from a source point to a reference point.

  • When model is set to "two-ray", ang is a 2-by-2N matrix. Alternate columns of ang refer to the line-of-sight path and reflected path, respectively.

More About

collapse all

Extended Capabilities

expand all

Version History

Introduced in R2019b