Main Content

plotTrack

Plot tracks in trackingGlobeViewer

Description

plotTrack(viewer,tracks) plots tracks on the tracking globe viewer.

Tip

The length of all plotted track history lines is determined by the TrackHistoryDepth property of the viewer. The viewer maintains each track internally by its TrackID and SourceIndex. If a previously encountered (TrackID,SourceIndex) pair is not found in the current call to the plotTrack function, the track is considered dropped. You can remove dropped tracks from the globe by specifying the ShowDroppedTracks property of the viewer as false.

plotTrack(viewer,trackCells) plots tracks with different track state definitions in the format of a cell array on the tracking globe viewer.

plotTrack(___,frame) specifies the reference frame used to interpret the coordinates of the tracks.

example

plotTrack(___,Name=Value) specifies options using one or more name-value pair arguments. For example, plotTrack(viewer,tracks,Color=[1 0 0]) specifies the color of the plotted tracks as the RGB triplet [1 0 0].

Examples

collapse all

Create a tracking globe viewer and specify the reference location and camera view.

refloc = [42.366978 -71.022362 50];
viewer = trackingGlobeViewer(ReferenceLocation=refloc);
campos(viewer,42.3374,-71.0605,872.7615);
camorient(viewer,[39 0 -2.7]);

Plot a track on the globe. The track state is in the format [x; vx; y; vy; z; vz]. By default, the reference frame of the track state is the local NED frame whose origin is specified by the ReferenceLocation property of the viewer. Take a snapshot and show the results.

track1 = objectTrack(TrackID=1,State=[10; 0; 10; 0;-50; 0],StateCovariance=100*eye(6));
plotTrack(viewer,track1,Color=[1 0 0]);
drawnow
snapshot(viewer)

Plot a second track on the globe. The track state is in the format [x;y;z;vx;vy;vz]. The reference frame of the track state is the local ENU frame, with its origin specified by the ReferenceLocation property of the viewer. Take a snapshot and show the results.

track2 = objectTrack(TrackID=2,State=[5000; 1000; 1280; 0; 0; 0],StateCovariance=100*eye(6));
% Define position and velocity selectors for non-default state definitions.
possel = [1 0 0 0 0 0; 0 1 0 0 0 0; 0 0 1 0 0 0];
velsel = [0 0 0 1 0 0; 0 0 0 0 1 0; 0 0 0 0 0 1];
plotTrack(viewer,track2,"ENU",PositionSelector=possel,VelocitySelector=velsel,Color=[0 1 0]);
drawnow
snapshot(viewer)

Plot a third track on the globe. The track state is in the format [x;y;z;d], where d is a nonpositional track state. The reference frame of the track state is the ECEF frame. Take a snapshot and show the results.

track3 = objectTrack(TrackID=3,State=[1.5349; -4.4634; 4.2761; 1e-5]*1e6,StateCovariance=200*eye(4));
possel = [1 0 0 0; 0 1 0 0; 0 0 1 0];
velsel = []; % no velocity
plotTrack(viewer,track3,"ECEF",PositionSelector=possel,VelocitySelector=velsel,Color=[0 0 1]);
drawnow

snapshot(viewer)

Input Arguments

collapse all

Tracking globe viewer, specified as a trackingGlobeViewer object.1

Object tracks, specified as an array of objectTrack objects or an array of track structures, where the field names of each track structure must be the same as the property names of a objectTrack object.

Object tracks with different state definitions, specified as a cell array of objectTrack object arrays or a cell array of track structure arrays. Use this input argument when plotting tracks with different state definitions. For example, if you want to plot two arrays of tracks, where the state of the first array of tracks is four-dimensional and the state of the second array of tracks is six-dimensional.

Reference frame, specified as "NED" for north-east down, "ENU" for east-north-up, or "ECEF" for Earth-centered-Earth-fixed. When specified as "NED" or "ENU", the origin of the reference frame is at the location specified by the ReferenceLocation property of the viewer object.

Data Types: char | string

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.

Example: plotTrack(viewer,tracks,Color=[1 0 0])

Position selector, specified as an M-by-N matrix of 0s and 1s, where M is dimension of the position state and N is the dimension of the track state. The selector selects the position state from the track state by premultiplying the track sate. The default selector, [1 0 0 0 0 0 ; 0 0 1 0 0 0; 0 0 0 0 1 0], selects [x; y; z] from a six-dimensional state [x; vx; y; vy; z; vz]. See getTrackPositions for more details.

Alternately, you can specify this argument as a P-element cell array of position selector matrices, where P is the number of cells in the trackCells input. Each selector matrix must select the position state from the corresponding track state in the trackCells input.

Data Types: single | double

Velocity selector, specified as an M-by-N matrix of 0s and 1s, where M is dimension of the velocity state and N is the dimension of the track state. The selector selects the velocity state from the track state by pre-multiplying the track sate. The default selector, [0 1 0 0 0 0 ; 0 0 0 1 0 0; 0 0 0 0 0 1], selects [vx; vy; vz] from a six-dimensional state [x; vx; y; vy; z; vz]. See getTrackVelocities for more details.

Alternately, you can specify this argument as a P-element cell array of velocity selector matrices, where P is the number of cells in the trackCells input. Each selector matrix must select the velocity state from the corresponding track state in the trackCells input.

Data Types: single | double

Width of the track history line, specified as a positive value in points, where 1 point = 1/72 of an inch. The line width cannot be thinner than the width of a pixel. If you set the line width to a value that is less than the width of a pixel on your system, the line displays as one pixel wide.

Color of tracks, specified as:

  • A RGB triplet — Plot all the tracks with the same color.

  • A Q-by-3 matrix of RGB triplets — Plot each track as a different color, where Q is the number tracks specified in the tracks input.

  • A P-by-3 matrix of RGB triplets — Plot each set of tracks with a given state definition in a different color, where P is the number of cells specified in the trackCells input.

Track label style, specified as one of these options:

  • "ID" — Display the track ID and source index.

  • "ATC" — Display using an air traffic control style that shows track ID, heading, climb rate, and ground speed of the track.

  • "Custom" — Use your own track label, specified in the CustomLabel name-value argument.

Data Types: single | double

Customized track labels, specified as:

  • A string scalar or a character vector — Use the same label for all the tracks.

  • A K-element array of strings or a K-element cell array of character vectors — Use a different label for each track. K is the total number of tracks plotted.

Example: CustomLabel={'track 1','track number 2'}

Version History

Introduced in R2021b

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