Plot rays in Site Viewer map
plot(
plots the propagation paths for ray objects in the Site Viewer map with additional options
specified by one or more name-value pair arguments.rays
,Name,Value
)
Return ray tracing results in comm.Ray
objects and plot the ray propagation path after relaunching the Site Viewer map.
Create a Site Viewer map, loading building data for Chicago. For more information about the osm file, see [1].
viewer = siteviewer('Buildings','chicago.osm');
Create and show a transmitter site on one building and a receiver site on another building.
tx = txsite('Latitude',41.8800,'Longitude',-87.6295, ... 'TransmitterFrequency',2.5e9); show(tx); rx = rxsite('Latitude',41.881352,'Longitude',-87.629771, ... 'AntennaHeight',30); show(rx);
Perform ray tracing, returning the ray object results. For the configuration defined, ray tracing returns a cell array containing one ray object. Display the ray object properties. Then, close the Site Viewer map.
rays = raytrace(tx,rx)
rays = 1×1 cell array
{1×1 comm.Ray}
rays{1}
ans = Ray with properties: PathSpecification: 'Locations' CoordinateSystem: 'Geographic' TransmitterLocation: [3×1 double] ReceiverLocation: [3×1 double] LineOfSight: 0 ReflectionLocations: [3×1 double] Frequency: 2.5000e+09 PathLossSource: 'Custom' PathLoss: 94.0915 PhaseShift: 1.2939 Read-only properties: PropagationDelay: 5.7088e-07 PropagationDistance: 171.1462 AngleOfDeparture: [2×1 double] AngleOfArrival: [2×1 double] NumReflections: 1
close(viewer);
You can plot the rays without performing ray tracing again. Create another Site Viewer map with the same buildings. Show the transmitter and receiver sites. Using the previously returned cell array of ray objects, plot the reflected rays between the transmitter site and the receiver site. The plot function can plot the path for one ray object at a time.
siteviewer('Buildings','chicago.osm'); show(tx); show(rx); plot(rays{1},'Type','power', ... 'TransmitterSite',tx,'ReceiverSite',rx);
Appendix
[1] The osm file is downloaded from https://www.openstreetmap.org, which provides access to crowd-sourced map data all over the world. The data is licensed under the Open Data Commons Open Database License (ODbL), https://opendatacommons.org/licenses/odbl/.
rays
— Ray configuration objectcomm.Ray
objectRay configuration, specified as one
comm.Ray
object or a vector of
comm.Ray
objects. Each object must have the
PathSpecification
property set to "Locations"
and the CoordinateSystem
property set to
"Geographic"
.
Data Types: comm.Ray
Specify optional
comma-separated pairs of Name,Value
arguments. Name
is
the argument name and Value
is the corresponding value.
Name
must appear inside quotes. You can specify several name and value
pair arguments in any order as
Name1,Value1,...,NameN,ValueN
.
plot(rays,"Type","pathloss","ColorLimits",[-100 0])
adds the
propagation path specified in rays
to the current Site Viewer and adjusts
the default color limits.'Type'
— Quantity type to plot"pathloss"
(default) | "power"
Quantity type to plot, specified as "pathloss"
or
"power"
. Based on the value specified for
Type
, the color applied along the path maps to the path loss in
dB or the power in dBm of the signal along the path.
Data Types: char
| string
'TransmitterSite'
— Transmitter sitetxsite
objectTransmitter site, specified as a txsite
object.
Applies only when Type
is set to
"power"
.
Data Types: char
'ReceiverSite'
— Receiver siterxsite
objectReceiver site, specified as an rxsite
object.
Applies only when Type
is set to
"power"
.
Data Types: char
'ColorLimits'
— Colormap color limitsColor limits for colormap, specified as a 1-by-2 numeric vector,
[min, max], where min
represents the lower saturation limit and max represents the upper
saturation limit. The default is [-120 -5] when Type
is set to
'power'
and [45 160] when Type
is set to
'pathloss'
.
Data Types: double
'Colormap'
— Colormap applied to propagation path'jet'
(default) | M-by-3 numeric arrayColormap applied to propagation path, specified as an M-by-3 numeric array of RGB (red,green,blue) triplets that define M individual colors.
Data Types: double
| char
| string
'ShowLegend'
— Show color legend on maptrue
(default) | false
Show color legend on map, specified as true
or
false
.
Data Types: logical
'Map'
— Map for visualization and surface datasiteviewer
objectMap for visualization and surface data, specified as a siteviewer
object.[1]
The default is the current siteviewer
object, or if no
Site Viewer is open a new siteviewer
object opens.
Data Types: siteviewer object
[1] Alignment of boundaries and region labels are a presentation of the feature provided by the data vendors and do not imply endorsement by MathWorks®.
You have a modified version of this example. Do you want to open this example with your edits?