link
Display or compute communication link status
Description
link(___,
displays a communication link using additional options specified by
Name,Value
)Name,Value
pairs.
returns
the success status of the communication link as status
= link(___)true
or
false
.
Examples
Create a transmitter site.
tx = txsite("Name","MathWorks", ... "Latitude",42.3001, ... "Longitude",-71.3503);
Create a receiver site with a sensitivity defined in dBm.
rx = rxsite("Name","Boston", ... "Latitude",42.3601, ... "Longitude",-71.0589, ... "ReceiverSensitivity",-90);
Plot the communication link between the transmitter and the receiver.
link(rx,tx)
Import and view an STL file. The file models a small conference room with one table and four chairs.
viewer = siteviewer('SceneModel','conferenceroom.stl');
Create a transmitter site near the upper corner of the room and a receiver site above the table. Specify the position using Cartesian coordinates in meters.
tx = txsite('cartesian', ... 'AntennaPosition',[-1.46; -1.42; 2.1]); rx = rxsite('cartesian', ... 'AntennaPosition',[0.3; 0.3; 0.85]);
Plot the communication link between the transmitter and the receiver.
link(rx,tx)
Pan by left-clicking, zoom by right-clicking or by using the scroll wheel, and rotate the visualization by clicking the middle button and dragging or by pressing Ctrl and left-clicking and dragging.
Input Arguments
Receiver site, specified as a rxsite
object. You can use array inputs to specify multiple sites.
Transmitter site, specified as a txsite
object. You can use array inputs to specify multiple sites.
Propagation model to use for the path loss calculations, specified as one of these options:
"freespace"
— Free space propagation model"rain"
— Rain propagation model"gas"
— Gas propagation model"fog"
— Fog propagation model"close-in"
— Close-in propagation model"longley-rice"
— Longley-Rice propagation model"tirem"
— TIREM™ propagation model"raytracing"
— Ray tracing propagation model that uses the shooting and bouncing rays (SBR) method. When you specify a ray tracing model as input, the function incorporates multipath interference by using a phasor sum.A propagation model created using the
propagationModel
function. For example, you can create a ray tracing propagation model that uses the image method by specifyingpropagationModel("raytracing","Method","image")
.
The default value depends on the coordinate system used by the input sites.
Coordinate System | Default propagation model value |
---|---|
"geographic" |
|
"cartesian" |
|
Terrain propagation models, including "longley-rice"
and
"tirem"
, are only supported for sites with a
CoordinateSystem
value of
"geographic"
.
You can also specify the propagation model by using the
PropagationModel
name-value pair argument.
Name-Value Arguments
Specify optional pairs of arguments as
Name1=Value1,...,NameN=ValueN
, where Name
is
the argument name and Value
is the corresponding value.
Name-value arguments must appear after other arguments, but the order of the
pairs does not matter.
Before R2021a, use commas to separate each name and value, and enclose
Name
in quotes.
Example: "Type","power"
Propagation model to use for the path loss calculations, specified as one of these options:
"freespace"
— Free space propagation model"rain"
— Rain propagation model"gas"
— Gas propagation model"fog"
— Fog propagation model"close-in"
— Close-in propagation model"longley-rice"
— Longley-Rice propagation model"tirem"
— TIREM propagation model"raytracing"
— Ray tracing propagation model that uses the shooting and bouncing rays (SBR) method. When you specify a ray tracing model as input, the function incorporates multipath interference by using a phasor sum.A propagation model created using the
propagationModel
function. For example, you can create a ray tracing propagation model that uses the image method by specifyingpropagationModel("raytracing","Method","image")
.
The default value depends on the coordinate system used by the input sites.
Coordinate System | Default propagation model value |
---|---|
"geographic" |
|
"cartesian" |
|
Terrain propagation models, including "longley-rice"
and
"tirem"
, are only supported for sites with a
CoordinateSystem
value of
"geographic"
.
Data Types: char
| string
Color of successful links, specified as one of these options:
An RGB triplet whose elements specify the intensities of the red, green, and blue components of the color. The intensities must be in the range
[0,1]
; for example,[0.4 0.6 0.7]
.A character vector such as
"red"
or"r"
.A string scalar such as
"red"
or"r"
.
This table contains the color names and equivalent RGB triplets for some common colors.
Color Name | Short Name | RGB Triplet | Appearance |
---|---|---|---|
"red" | "r" | [1 0 0] |
|
"green" | "g" | [0 1 0] |
|
"blue" | "b" | [0 0 1] |
|
"cyan"
| "c" | [0 1 1] |
|
"magenta" | "m" | [1 0 1] |
|
"yellow" | "y" | [1 1 0] |
|
"black" | "k" | [0 0 0] |
|
"white" | "w" | [1 1 1] |
|
Data Types: char
| string
| double
Color of unsuccessful links, specified as one of these options:
An RGB triplet whose elements specify the intensities of the red, green, and blue components of the color. The intensities must be in the range
[0,1]
; for example,[0.4 0.6 0.7]
.A character vector such as
"red"
or"r"
.A string scalar such as
"red"
or"r"
.
This table contains the color names and equivalent RGB triplets for some common colors.
Color Name | Short Name | RGB Triplet | Appearance |
---|---|---|---|
"red" | "r" | [1 0 0] |
|
"green" | "g" | [0 1 0] |
|
"blue" | "b" | [0 0 1] |
|
"cyan"
| "c" | [0 1 1] |
|
"magenta" | "m" | [1 0 1] |
|
"yellow" | "y" | [1 1 0] |
|
"black" | "k" | [0 0 0] |
|
"white" | "w" | [1 1 1] |
|
Data Types: char
| string
| double
Map for visualization or surface data, specified as a siteviewer
object, a triangulation
object, a string scalar, or a character vector.
Valid and default values depend on the coordinate system.
Coordinate System | Valid map values | Default map value |
---|---|---|
"geographic" |
|
|
"cartesian" |
|
|
a Alignment of boundaries and region labels are a presentation of the feature provided by the data vendors and do not imply endorsement by MathWorks®. |
In most cases, if you specify this argument as a value other than a siteviewer
or
"none"
, then you must also specify an output argument.
Data Types: char
| string
Output Arguments
Success status of communication links, returned as an M-by-N arrays. M is the number of transmitter sites and N is the number of receiver sites.
References
[1] Mohr, Peter J., Eite Tiesinga, David B. Newell, and Barry N. Taylor. “Codata Internationally Recommended 2022 Values of the Fundamental Physical Constants.” NIST, May 8, 2024. https://www.nist.gov/publications/codata-internationally-recommended-2022-values-fundamental-physical-constants.
Extended Capabilities
The link
function supports ray
tracing analysis on a GPU with these usage notes and limitations:
The function runs on the GPU when you specify a
RayTracing
propagation model object as input and theUseGPU
property of the object is"on"
or"auto"
.For information about when the GPU can accelerate ray tracing analysis, see the
UseGPU
property of theRayTracing
object.In some cases, the GPU and local CPU results can differ due to small differences in algorithms and hardware implementations.
For an example that shows how to perform ray tracing analysis on a GPU, see Accelerate Ray Tracing Analysis Using GPU.
Version History
Introduced in R2017bWhen calculating communication links using ray tracing models, the
link
function performs the ray tracing analysis
using additional materials. As a result of this change, depending on the materials
in the scene, the link
function can return different
values in R2025a compared to previous releases.
When calculating communication links using ray tracing models, the
link
function uses improved algorithms and constant
values.
The SBR method uses additional edges in the scene as candidates for diffraction. As a result, the SBR method can find more rays in R2025a compared to previous releases.
When you specify transmitters and receivers that have polarized antennas from Antenna Toolbox™ or Phased Array System Toolbox™, the function calculates the phase shifts of rays using an improved algorithm that differently incorporates the far-field patterns of the antennas.
The function uses the constant values that are recommended by the 2022 Committee on Data of the International Science Council (CODATA) adjustment of fundamental constants [1]. In previous releases, the function used constant values from International Telecommunication Union Recommendations (ITU-R) P.2040 and P.527.
As a result of these changes, the link
function can
return different values in R2025a compared to previous releases.
The link
function performs ray tracing analysis with multiple materials in the same scene when:
You create the scene from a glTF file, and specify the
propmodel
input argument as"raytracing"
or aRayTracing
propagation model object with itsSurfaceMaterial
property set to"auto"
(the default).You create the scene from an OpenStreetMap® file or a geospatial table, and you specify the
propmodel
input argument as"raytracing"
or aRayTracing
propagation model object with itsBuildingsMaterial
property set to"auto"
(the default).
The link
function performs the ray tracing analysis using the
materials stored in the file or table. If the file or table does not specify materials, or
if the file or table specifies a material that the ray tracing analysis does not support,
then the function uses concrete instead of the absent or unsupported material.
As a result, the link
function can return different values in
R2023b compared to previous releases. To avoid using the materials stored in the file or
table, create a RayTracing
object (by using the propagationModel
function) and set its SurfaceMaterial
property to
"plasterboard"
and its BuildingsMaterial
property to "concrete"
. Then, use the object as input to the
link
function.
The link
function shows improved performance with complex scenes when you specify a RayTracing
propagation model object that uses the shooting and bouncing rays (SBR) method as input.
The time that MATLAB® requires to perform ray tracing analysis depends on the scene and on the
properties of the RayTracing
object, such as the
AngularSeparation
, MaxNumDiffractions
,
MaxNumReflections
, MaxAbsolutePathLoss
, and
MaxRelativePathLoss
properties. In some cases, with moderate values
of the MaxAbsolutePathLoss
and MaxRelativePathLoss
properties, the ray tracing analysis can be more than 2x faster in R2023b than in
R2023a.
Ray tracing propagation models discard propagation paths based on path loss
thresholds. By default, when you specify the propmodel
input
argument as "raytracing"
or a RayTracing
object, the propagation model discards paths that are more than 40 dB weaker than
the strongest path.
As a result, the link
function can return different values in
R2023a compared to previous releases. To avoid discarding paths based on relative
path loss thresholds, create a RayTracing
object (by using the
propagationModel
function) and set its
MaxRelativePathLoss
property to Inf
.
Then, use the object as input to the link
function.
When calculating received power using ray tracing models, the
link
function now incorporates multipath interference by
using a phasor sum. In previous releases, the function used a power sum. As a
result, the calculations in R2022b are more accurate than in previous
releases.
Starting in R2021b, when you use the link
function and
specify the propmodel
argument or
PropagationModel
name-value argument as
"raytracing"
, the function uses the shooting and bouncing
rays (SBR) method and calculates up to two reflections. In previous releases, the
link
function uses the image method and calculates up to
one reflection.
To display or compute communication link status using the image method instead,
create a propagation model by using the propagationModel
function. Then, use the link
function with the propagation model as input. This example shows how to update your
code.
pm = propagationModel("raytracing","Method","image"); link(rx,tx,pm)
For information about the SBR and image methods, see Choose a Propagation Model.
Starting in R2021b, all RF Propagation functions use the SBR method by default and calculate up to two reflections. For more information, see Default modeling method is shooting and bouncing rays method.
MATLAB Command
You clicked a link that corresponds to this MATLAB command:
Run the command by entering it in the MATLAB Command Window. Web browsers do not support MATLAB commands.
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
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
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
- United Kingdom (English)