Range and angle calculation
[rng,ang] = rangeangle(pos)
[rng,ang] = rangeangle(pos,refpos)
[rng,ang] = rangeangle(pos,refpos,refaxes)
[rng,ang] = rangeangle(___,model)
rangeangle determines the
propagation path length and path direction of a signal from any point
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 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. Path lengths are independent of the coordinate system.
[ returns the propagation
rng, and direction,
of a signal path from one point or set of points,
to the reference point. In this syntax, the reference point coincides
with the global coordinate system origin. Directions are specified
by azimuth and elevation angles with respect to the global coordinate
system. Signals follow a line-of-sight path from the source to the
origin. The line-of-sight path corresponds to the geometric straight
line between the points.
in addition, specifies a propagation model. When
'freespace', the signal propagates along
a line-of-sight path from source point to reception point. When
'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.
Point position, specified as a 3-by-N real-valued
matrix of rectangular coordinates where each column takes the form
Reference position, specified as a real-valued 3-by-1 vector
of rectangular coordinates in the form
Local coordinate system axes, specified as a real-valued 3-by-3
matrix whose columns define the axes of the local coordinate system
with origin at
Propagation model, taking the value
Propagation distance, returned as a 1-by-M vector
of ranges from the source to the positions defined by the corresponding
Azimuth and elevation angles, returned as a 2-by-M matrix
whose columns are angles in the form
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 = 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 = 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 = 19.6538 1.0900
Compute the two-ray propagation distances and arrival angles of rays from a source located at (1000,1000,500) meters from the origin. The receiver is located at (100,100,200) meters from the origin.
sourceLoc = [1000;1000;500]; receiverLoc = [100;100;200]; [sourcerngs,sourceangs] = rangeangle(sourceLoc,receiverLoc,'two-ray')
sourcerngs = 1.0e+03 * 1.3077 1.4526 sourceangs = 45.0000 45.0000 13.2627 -28.8096
Find the range and angle of the same target with the same origin but with respect to a local coordinate axes. The local coordinate axes are rotated around the z-axis by 45 degrees from the global coordinate axes.
refaxes = rotz(45); [sourcerngs,sourceangs] = rangeangle(sourceLoc,receiverLoc,refaxes,'two-ray')
sourcerngs = 1.0e+03 * 1.3077 1.4526 sourceangs = 0 0 13.2627 -28.8096
rangeangle function returns the path
distance and path angles in either the global or local coordinate
systems. Every antenna or microphone element and array has a gain
pattern that is expressed in local angular coordinates of azimuth
and elevation. As the element or array moves or rotates, the gain
pattern is carried with it. To determine the strength of a signal’s
transmission or reception, you must know the angle that the signal
path makes with respect to the local angular coordinates of the element
or array. By default, the
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,
the figure below shows a 5-by-5 uniform rectangular array (URA) rotated
from the global coordinates (xyz) using
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 elevations angles (φ,θ) and
the local coordinate system defines the azimuth and elevations angles (φ',θ').
Local and Global Coordinate Axes
The free-space signal propagation model states that a signal propagating from one point to another in a homogeneous, 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. Similar assumptions are made for sonar but the term isovelocity channel is usually used in place of free space.
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 homogeneous, 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 (see 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.
phased.WidebandTwoRayChannel System objects model
propagation time delay, phase shift, Doppler shift, and loss effects
for both paths. For the reflected path, loss effects include reflection
loss at the boundary.
The figure illustrates two propagation paths. From the source
position, ss, and the receiver
position, sr, you can compute
the arrival angles of both paths, θ′los and θ′rp.
The arrival angles are the elevation and azimuth angles of the arriving
radiation 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 boundary
is the same as the angles θrp and θ′rp.
The reflection angle is important to know when you use angle-dependent
reflection-loss data. You can determine the reflection angle by using
rangeangle function and
setting the reference axes to the global coordinate system. The total
path length for the line-of-sight path is shown in the figure by Rlos which
is equal to the geometric distance between source and receiver. The
total path length for the reflected path is Rrp=
R1 + R2. The
quantity L is the ground range between source and
You can easily derive exact formulas for path lengths and angles in terms of the ground range and objects heights in the global coordinate system.
Usage notes and limitations:
Does not support variable-size inputs.