www.gusucode.com > phased 案例源码 matlab代码程序 > phased/ViewTrajectoriesAirborneRadarAndGroundTargetExample.m

    %% View Tracks of Airborne Radar and Ground Target
% Visualize the tracks of an airborne radar and a ground vehicle
% target. The airborne radar is carried by a drone flying at 5 km altitude.
%%
% 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(TM). Show the radar beam
% and annotate the tracks with position, speed, and, altitude.
sSV = 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. Then, 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);
    sSV.BeamSteering = ang;
    step(sSV,radar_pos,radar_vel,tgt_pos,tgt_vel);
    pause(.1);
end