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

    %% RTI Display of Three Moving Targets
% Use the |phased.IntensityScope| System object(TM) to display the
% intensities of the echoes of three moving targets as functions of range
% and time.

%% Create the Radar and Target System Objects
% Set up the initial positions and velocities of the three targets. Use the
% |phased.Platform| System object(TM) to model radar and target motions.
% The radar is stationary while the targets undergo constant velocity
% motion. The simulation runs for 500 steps at 0.1 second increments,
% giving a total simulation time of 50 seconds.
nsteps = 500;
dt = .1;
timespan = nsteps*dt;
x1 = [60,0,0]';
x2 = [60,-80,40]';
x3 = [300,0,-300]';
v1 = [2,0,0]';
v2 = [10,5,6]';
v3 = [-10,2,-4]';
platform = phased.Platform([0,0,0]',[0,0,0]');
targets = phased.Platform([x1,x2,x3],[v1,v2,v3]);

%% Set Up Range Bins
% Each echo is put into a range bin. The range bin resolution is 1 meter and
% the range is from 50 to 1000 meters.
rngres = 1.0;
rngmin = 50.0;
rngmax = 1000.0;
rngscan = [rngmin:rngres:rngmax];

%% Create the Gain Function
% Define a range-dependent gain function to enhance the display of targets
% at larger ranges. The gain function amplifies the returned echo for
% visualization purposes only.
rangegain = @(rng)(1e12*rng^4);

%% Create the Intensity Scope
% Set up the Intensity Scope using these properties.
%
% * Use the |XResolution| property to set the width of each scan
% line bin to the range resolution of 1 km.
% * Use the |XOffset| property to set the value of the lowest range
% bin to the minimum range of 50 km.
% * Use the |TimeResolution| property to set the value of the scan line time difference
% to 0.1 s.
% * Use the |TimeSpan| property to set the height of the display window to
% the time duration of the simulation.
% * Use the |IntensityUnits| property to set the display units to |Watts|.
%
scope = phased.IntensityScope('Name','IntensityScope Display',...
    'Title','Ranges vs. Time','XLabel','Range (m)','XResolution',rngres,...
    'XOffset',rngmin,'TimeResolution',dt,'TimeSpan',timespan, ...
    'IntensityUnits','Watts','Position',[100,100,800,450]);

%% Run Simulation Loop
%
% # In this loop, move the targets at constant velocity using the |step|
% method of the |phased.Platform| System object.
% # Compute the target ranges using the |rangeangle| function.
% # Compute the target range bins by quantizing the range values in integer multiples of |rangres|.
% # Fill each target range bin and neighboring bins with a simulated radar intensity value.
% # Add the signal from each target to the scan line.
% # Call the |step| method of the |phased.IntensityScope| System object to
% display the scan lines.
%
for k = 1:nsteps
    xradar = platform(dt);
    xtgts = targets(dt);
    [rngs] = rangeangle(xtgts,xradar);
    scanline = zeros(size(rngscan));
    
    rngindx = ceil((rngs(1) - rngmin)/rngres);
    scanline(rngindx + [-1:1]) = rangegain(rngs(1))/(rngs(1)^4);
    
    rngindx = ceil((rngs(2) - rngmin)/rngres);
    scanline(rngindx + [-1:1]) = rangegain(rngs(2))/(rngs(2)^4);
    
    rngindx = ceil((rngs(3) - rngmin)/rngres);
    scanline(rngindx + [-1:1]) = rangegain(rngs(3))/(rngs(3)^4);
    
    scope(scanline.');
    pause(.1);
end