Main Content

los

Plot or compute the line-of-sight (LOS) visibility between sites on a map

Description

example

los(site1,site2) plots the LOS from site 1 to site 2. The plot is color coded to identify the visibility of the points along the LOS.

example

los(site1,site2,Name,Value) sets properties using one or more name-value pairs. For example, los(site1,site2,'ObstructedColor','red') plots the LOS using red to show blocked visibility.

vis = los(site1,site2,Name,Value) returns the status of the LOS visibility.

Examples

collapse all

Plot the LOS from the MathWorks Apple Hill campus to the MathWorks Lakeside campus.

Create a transmitter site with an antenna of height 30 m.

tx = txsite('Name','MathWorks Apple Hill',...
      	'Latitude',42.3001,'Longitude',-71.3504,'AntennaHeight',30);

Create a receiver site with an antenna at ground level.

rx = rxsite('Name','MathWorks Lakeside', ...
   	    'Latitude',42.3021,'Longitude',-71.3764);

Plot the LOS between the two sites.

los(tx,rx);

Create a transmitter site with an antenna of height 30 m.

tx = txsite('Name','MathWorks Apple Hill',...
      	'Latitude',42.3001,'Longitude',-71.3504,'AntennaHeight',30);

Create two receiver sites with antennas at ground level.

names = ["Fenway Park","Bunker Hill Monument"];
lats = [42.3467,42.3763];
lons = [-71.0972,-71.0611];

Create the receiver site array.

rxs = rxsite('Name', names,...
      'Latitude',lats,...
      'Longitude',lons);
  

Plot the lines of sight to the receiver sites. The red portion of the LOS represents obstructed visibility.

los(tx,rxs);

Input Arguments

collapse all

Source antenna site, specified as a txsite object or a rxsite object. Site 1 must be a single site object.

Target antenna site, specified as a txsite object or a rxsite object. Site 2 can be a single site object or a vector of multiple site objects.

Name-Value Pair Arguments

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.

Example: 'ObstructedColor','blue'

Plot color for successful visibility, specified as an RGB triplet, a character vector, or a color name specified as a string. For more information, see ColorSpec (Color Specification).

Plot color for blocked visibility, specified as an RGB triplet, a character vector, or a color name specified as a string. For more information, see ColorSpec (Color Specification).

Resolution of sample locations used to compute line-of-sight visibility, specified as 'auto' or a numeric scalar expressed in meters. Resolution defines the distance between samples on the great circle path using a spherical Earth model. If Resolution is 'auto', the function computes a value based on the distance between the sites.

Map for visualization or surface data, specified as the comma-separated pair consisting of 'Map and one of the following depending on the coordinate system:

Coordinate SystemValid map valuesDefault map value
'geographic'
  • siteviewer[a]

  • A terrain name may be specified if the function is called with an output argument. Valid terrain names are 'none', 'gmted2010', or the name of the custom terrain data added using addCustomTerrain

  • current siteviewer or new siteviewer if none are open.

  • 'gmted2010' if called with an output.

'cartesian''none', triangulation object or name of an STL file.'none'

[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®.

Data Types: char | string

Output Arguments

collapse all

Status of LOS visibility, returned as 'true' or 'false'. If there are multiple target sites, the function returns a logical array of n-by-1.

Introduced in R2019b