Main Content

step

System object: phased.ScenarioViewer
Namespace: phased

Update scenario viewer display

Syntax

step(sSV,radar_pos,tgt_pos)
step(sSV,radar_pos,tgt_pos,radar_velocity,tgt_velocity)
step(sSV,radar_pos,radar_laxes,tgt_pos,tgt_laxes)
step(sSV,radar_pos,radar_velocity,radar_laxes,tgt_pos,tgt_velocity,tgt_laxes)

Description

Note

Starting in R2016b, instead of using the step method to perform the operation defined by the System object™, you can call the object with arguments, as if it were a function. For example, y = step(obj,x) and y = obj(x) perform equivalent operations.

step(sSV,radar_pos,tgt_pos) updates the scenario viewer display with new radar positions, radar_pos, and target positions, tgt_pos. This syntax applies when VelocityInputPort and OrientationInputPort are set to false.

step(sSV,radar_pos,tgt_pos,radar_velocity,tgt_velocity) also specifies the radar velocity, radar_velocity, and target velocity, tgt_velocity. This syntax applies when VelocityInputPort is set to true and OrientationInputPort is set to false.

step(sSV,radar_pos,radar_laxes,tgt_pos,tgt_laxes) also specifies the radar orientation axes, radar_laxes, and the target orientation axes, tgt_laxes. This syntax applies when VelocityInputPort is set to false and OrientationInputPort is set to true.

step(sSV,radar_pos,radar_velocity,radar_laxes,tgt_pos,tgt_velocity,tgt_laxes) also specifies velocity and orientation axes when VelocityInputPort and OrientationInputPort are set to true.

Note

The object performs an initialization the first time the object is executed. This initialization locks nontunable properties and input specifications, such as dimensions, complexity, and data type of the input data. If you change a nontunable property or an input specification, the System object issues an error. To change nontunable properties or inputs, you must first call the release method to unlock the object.

Input Arguments

expand all

Scenario viewer, specified as a phased.ScenarioViewer System object.

Example: phased.ScenarioViewer

Radar positions, specified as a real-valued 3-by-N matrix. N is the number of radar tracks and must be equal to or greater than one. Each column has the form [x;y;z]. Position units are in meters.

Example: [100,250,75;0,20,49;300,5,120]

Data Types: double

Target positions, specified as a real-valued 3-by-N matrix. M is the number of target tracks and must be equal to or greater than one. Each column has the form [x;y;z]. Position units are in meters.

Example: [200,40;10,40;305,15]

Data Types: double

Radar velocities, specified as a real-valued 3-by-N matrix. N is the number of radar tracks and must be equal to or greater than one. Each column has the form [vx;vy;vz]. The dimensions of radar_velocity must match the dimensions of radar_pos. Velocity units are in meters per second.

Example: [100,10,0;4,0,7;100,500,0]

Data Types: double

Target velocities, specified as a real-valued 3-by-M matrix. M is the number of target tracks and must be equal to or greater than one. Each column has the form [vx;vy;vz]. The dimensions of tgt_velocity must match the dimensions of target_position. Velocity units are in meters per second.

Example: [100,10,0;4,0,7;100,500,0]

Data Types: double

Local coordinate axes of radar, specified as a real-valued 3-by-3-by-N array. N is the number of radar tracks. Each page (third index) represents a 3-by-3 orthogonal matrix that specifies the local coordinate axes of one radar. The columns are the unit vectors that form the x, y, and z axes of the local coordinate system. Array units are dimensionless.

Example: [100,10,0;4,0,7;100,500,0]

Data Types: double

Local coordinate axes of target, specified as a real-valued 3-by-3-by-M array. M is the number of target tracks. Each page (third index) represents a 3-by-3 orthogonal matrix that specifies the local coordinate axes of one radar. The columns are the unit vectors that form the x, y, and z axes of the local coordinate system. Array units are dimensionless.

Example: [100,10,0;4,0,7;100,500,0]

Data Types: double

Examples

expand all

Visualize the tracks of a radar and a single airplane target. The radar is stationary and the airplane is moving in a straight line. Maintain the radar beam pointing at the airplane.

Create the radar and airplane platform System objects™. Set the update rate to 0.1 s.

updateRate = 0.1;
radarPlatform = phased.Platform(...
    'InitialPosition',[0;0;10], ...
    'Velocity',[0;0;0]);
airplanePlatforms = phased.Platform(...
    'InitialPosition',[5000.0;3500.0;6000.0],...
    'Velocity',[-300;0;0]);

Create the phased.ScenarioViewer System object. Show the radar beam and annotate the tracks with position, speed, and altitude.

sSV = phased.ScenarioViewer('BeamRange',5000.0,'UpdateRate',updateRate,...
    'PlatformNames',{'Ground Radar','Airplane'},'ShowPosition',true,...
    'ShowSpeed',true,'ShowAltitude',true,'ShowLegend',true);

Run the scenario. At each step, compute the angle to the target. Use that angle to steer the radar beam toward the target.

for i = 1:100
    [radar_pos,radar_vel] = step(radarPlatform,updateRate);
    [tgt_pos,tgt_vel] = step(airplanePlatforms,updateRate);
    [rng,ang] = rangeangle(tgt_pos,radar_pos);
    sSV.BeamSteering = ang;
    step(sSV,radar_pos,radar_vel,tgt_pos,tgt_vel);
    pause(0.1);
end

Visualize the tracks of an airborne radar and a ground vehicle target. The airborne radar is carried by a drone flying at an altitude of 5 km.

Create the drone radar and ground vehicle using phased.Platform System objects™. Set the update rate to 0.1 s.

updateRate = 0.1;
drone = phased.Platform(...
    'InitialPosition',[100;1000;5000], ...
    'Velocity',[400;0;0]);
vehicle = phased.Platform('MotionModel','Acceleration',...
    'InitialPosition',[5000.0;3500.0;0.0],...
    'InitialVelocity',[40;5;0],'Acceleration',[0.1;0.1;0]);

Create the phased.ScenarioViewer System object. Show the radar beam and annotate the tracks with position, speed, and altitude.

viewer = phased.ScenarioViewer('BeamRange',8000.0,'BeamWidth',2,'UpdateRate',updateRate,...
    'PlatformNames',{'Drone Radar','Vehicle'},'ShowPosition',true,...
    'ShowSpeed',true,'ShowAltitude',true,'ShowLegend',true,'Title','Vehicle Tracking Radar');

Run the scenario. At each step, compute the angle to the target. Use that angle to steer the radar beam toward the target.

for i = 1:100
    [radar_pos,radar_vel] = step(drone,updateRate);
    [tgt_pos,tgt_vel] = step(vehicle,updateRate);
    [rng,ang] = rangeangle(tgt_pos,radar_pos);
    viewer.BeamSteering = ang;
    viewer(radar_pos,radar_vel,tgt_pos,tgt_vel)
    pause(.1)
end

This example shows how to create and display a multiplatform scenario containing a ground-based stationary radar, a turning airplane, a constant-velocity airplane, and a moving ground vehicle. The turning airplane follows a parabolic flight path while descending at a rate of 20 m/s.

Specify the scenario refresh rate at 0.5 Hz. For 150 steps, the time duration of the scenario is 300 s.

updateRate = 0.5;
N = 150;

Set up the turning airplane using the Acceleration model of the phased.Platform System object™. Specify the initial position of the airplane by range and azimuth from the ground-based radar and its elevation. The airplane is 10 km from the radar at 60° azimuth and has an altitude of 6 km. The airplane is accelerating at 10 m/s² in the negative x-direction.

airplane1range = 10.0e3;
airplane1Azimuth = 60.0;
airplane1alt = 6.0e3;
airplane1Pos0 = [cosd(airplane1Azimuth)*airplane1range;...
    sind(airplane1Azimuth)*airplane1range;airplane1alt];
airplane1Vel0 = [400.0;-100.0;-20];
airplane1Accel = [-10.0;0.0;0.0];
airplane1platform = phased.Platform('MotionModel','Acceleration',...
    'AccelerationSource','Input port','InitialPosition',airplane1Pos0,...
    'InitialVelocity',airplane1Vel0,'OrientationAxesOutputPort',true,...
    'InitialOrientationAxes',eye(3));

Set up the stationary ground radar at the origin of the global coordinate system. To simulate a rotating radar, change the ground radar beam steering angle in the processing loop.

groundRadarPos = [0,0,0]';
groundRadarVel = [0,0,0]';
groundradarplatform = phased.Platform('MotionModel','Velocity',...
    'InitialPosition',groundRadarPos,'Velocity',groundRadarVel,...
    'InitialOrientationAxes',eye(3));

Set up the ground vehicle to move at a constant velocity.

groundVehiclePos = [5e3,2e3,0]';
groundVehicleVel = [50,50,0]';
groundvehicleplatform = phased.Platform('MotionModel','Velocity',...
    'InitialPosition',groundVehiclePos,'Velocity',groundVehicleVel,...
    'InitialOrientationAxes',eye(3));

Set up the second airplane to also move at constant velocity.

airplane2Pos = [8.5e3,1e3,6000]';
airplane2Vel = [-300,100,20]';
airplane2platform = phased.Platform('MotionModel','Velocity',...
    'InitialPosition',airplane2Pos,'Velocity',airplane2Vel,...
    'InitialOrientationAxes',eye(3));

Set up the scenario viewer. Specify the radar as having a beam range of 8 km, a vertical beam width of 30°, and a horizontal beam width of 2°. Annotate the tracks with position, speed, altitude, and range.

BeamSteering = [0;50];
viewer = phased.ScenarioViewer('BeamRange',8.0e3,'BeamWidth',[2;30],'UpdateRate',updateRate,...
    'PlatformNames',{'Ground Radar','Turning Airplane','Vehicle','Airplane 2'},'ShowPosition',true,...
    'ShowSpeed',true,'ShowAltitude',true,'ShowLegend',true,'ShowRange',true,...
    'Title','Multiplatform Scenario','BeamSteering',BeamSteering);

Step through the display processing loop, updating radar and target positions. Rotate the ground-based radar steering angle by four degrees at each step.

for n = 1:N
    [groundRadarPos,groundRadarVel] = groundradarplatform(updateRate);
    [airplane1Pos,airplane1Vel,airplane1Axes] = airplane1platform(updateRate,airplane1Accel);
    [vehiclePos,vehicleVel] = groundvehicleplatform(updateRate);
    [airplane2Pos,airplane2Vel] = airplane2platform(updateRate);
    viewer(groundRadarPos,groundRadarVel,[airplane1Pos,vehiclePos,airplane2Pos],...
        [airplane1Vel,vehicleVel,airplane2Vel]);
    BeamSteering = viewer.BeamSteering(1);
    BeamSteering = mod(BeamSteering + 4,360.0);
    if BeamSteering > 180.0
        BeamSteering = BeamSteering - 360.0;
    end
    viewer.BeamSteering(1) = BeamSteering;
    pause(0.2);
end

Version History

Introduced in R2016a