Range and angle calculation
Since R2019b
collapse all in page
Syntax
[rng,ang]= rangeangle(pos)
[rng,ang]= rangeangle(pos,refpos)
[rng,ang]= rangeangle(pos,refpos,refaxes)
[rng,ang]= rangeangle(___,model)
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.
example
[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
.
[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
Range and Angle Computation
Open Live Script
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
Range and Angle With Respect to Local Origin
Open Live Script
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
Range and Angle With Respect to Local Coordinates
Open Live Script
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
pos
— Source point position
real-valued 3-by-1 vector | real-valued 3-by-N matrix
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
refpos
— Reference point position
[0;0;0]
(default) | real-valued 3-by-1 vector | real-valued 3-by-N matrix
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
refaxes
— Local coordinate system axes
[1 0 0;0 1 0;0 0 1]
(default) | real-valued 3-by-3 matrix | real-valued 3-by-3-by-N array
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
model
— Propagation model
"freespace"
(default) | "two-ray"
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
rng
— Propagation range
real-valued 1-by-N vector | real-valued 1-by-2N vector
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 ofrng
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 ofrng
refer to the line-of-sight path and reflected path, respectively for the same source-reference point pair.
ang
— Azimuth and elevation angles
real-valued 2-by-N matrix | real-valued 2-by-2N matrix
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 ofang
refer to the line-of-sight path and reflected path, respectively.
More About
collapse all
Angles in Local and Global Coordinate Systems
The rangeangle
function returns the path distance and path angles in either the global or local coordinate systems. By default, the rangeangle
function determines the angle a signal path makes with respect to global coordinates. If you add the refaxes
argument, you can compute the angles with respect to local coordinates. As an illustration, this figure shows a 5-by-5 uniform rectangular array (URA) rotated from the global coordinates (xyz) using refaxes
. The x' axis of the local coordinate system (x'y'z') is aligned with the main axis of the array and moves as the array moves. The path length is independent of orientation. The global coordinate system defines the azimuth and elevation angles (Φ,θ) and the local coordinate system defines the azimuth and elevations angles (Φ',θ').
Local and Global Coordinate Axes
Free Space Propagation Model
The free-space signal propagation model states that a signal propagating from one point to another in a hom*ogeneous, isotropic medium travels in a straight line, called the line-of-sight or direct path. The straight line is defined by the geometric vector from the radiation source to the destination.
Two-Ray Propagation Model
A two-ray propagation channel is the next step up in complexity from a free-space channel and is the simplest case of a multipath propagation environment. The free-space channel models a straight-line line-of-sight path from point 1 to point 2. In a two-ray channel, the medium is specified as a hom*ogeneous, isotropic medium with a reflecting planar boundary. The boundary is always set at z = 0. There are at most two rays propagating from point 1 to point 2. The first ray path propagates along the same line-of-sight path as in the free-space channel. The line-of-sight path is often called the direct path. The second ray reflects off the boundary before propagating to point 2. According to the Law of Reflection , the angle of reflection equals the angle of incidence. In short-range simulations such as cellular communications systems and automotive radars, you can assume that the reflecting surface, the ground or ocean surface, is flat.
The figure illustrates two propagation paths. From the sourceposition, ss, and the receiverposition, sr, you can computethe arrival angles of both paths, θ′los and θ′rp.The arrival angles are the elevation and azimuth angles of the arrivingradiation with respect to a local coordinate system. In this case,the local coordinate system coincides with the global coordinate system.You can also compute the transmitting angles, θlos and θrp.In the global coordinates, the angle of reflection at the boundaryis the same as the angles θrp and θ′rp.The reflection angle is important to know when you use angle-dependentreflection-loss data. You can determine the reflection angle by usingthe rangeangle (Phased Array System Toolbox) function andsetting the reference axes to the global coordinate system. The totalpath length for the line-of-sight path is shown in the figure by Rlos whichis equal to the geometric distance between source and receiver. Thetotal path length for the reflected path is Rrp=R1 + R2. Thequantity L is the ground range between source andreceiver.
You can easily derive exact formulas for path lengths and angles in terms of the ground range and object heights in the global coordinate system.
Extended Capabilities
C/C++ Code Generation
Generate C and C++ code using MATLAB® Coder™.
Usage notes and limitations:
Does not support variable-size inputs.
Version History
Introduced in R2019b
Commande MATLAB
Vous avez cliqué sur un lien qui correspond à cette commande MATLAB:
Pour exécuter la commande, saisissez-la dans la fenêtre de commande de MATLAB. Les navigateurs web ne supportent pas les commandes MATLAB.
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list:
Americas
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- Deutsch
- English
- Français
- United Kingdom (English)
Asia Pacific
- Australia (English)
- India (English)
- New Zealand (English)
- 中国
- 日本 (日本語)
- 한국 (한국어)
Contact your local office