Visualize Multiplatform Scenario
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