www.gusucode.com > phased 案例源码 matlab代码程序 > phased/IntensityScopeDisplayAngularMotionOfTargetExample.m
%% Intensity Scope Display of Target Angular Motion % Use the |phased.IntensityScope| System object(TM) to display the angular motions of moving % targets as functions of time. Each horizontal line (scan line) shows the % strength of radar echoes at different azimuth angles. Azimuth space is divided into % azimuth bins and each bin is filled with a simulated value depending upon % the position of the targets. %% Create 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 200 steps at 0.5 second intervals, % giving a total simulation time of 100 seconds. nsteps = 200; dt = 0.5; timespan = nsteps*dt; x1 = [60,0,0]'; x2 = [60,-80,40]'; x3 = [300,0,-300]'; x3 = [-300,0,-300]'; v1 = [2,0,0]'; v2 = [10,5,6]'; v3 = [-10,2,-4]'; radarplatform = phased.Platform([0,0,0]',[0,0,0]'); targets = phased.Platform([x1,x2,x3],[v1,v2,v3]); %% Set Up Azimuth Angle Bins % The signal for each echo is put into an angle bin and two adjacent bins. Bin resolution is 1 degree and % the angle span is from -180 to 180 degrees. angres = 1.0; angmin = -180.0; angmax = 180.0; angscan = [angmin:angres:angmax]; na = length(angscan); %% Range 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); %% Set Up Scope Viewer % The |XResolution| name-value pair specifies the width of each bin of the % scan line. The |XOffset| sets the value of the lowest azimuth angle bin. The % |TimeResolution| name-value pair specifies the time difference between % scan lines. The |TimeSpan| name-value pair sets the height of the display % window. A scan line is created with each call to the |step| method. % Intensity units are amplitude units. scope = phased.IntensityScope( ... 'Name','IntensityScope Display',... 'Title','Azimuth vs. Time',... 'XLabel','Azimuth (deg)', ... 'XResolution',angres,'XOffset',angmin,... 'TimeResolution',dt,'TimeSpan',timespan, ... 'IntensityUnits','Watts',... 'Position',[100,100,800,450]); %% Update-Display Loop % % # In this loop, move the targets at constant velocity using the |step| % method of the |phased.Platform| System object. % # Compute the target ranges and azimuth angles using the |rangeangle| function. % # Compute the azimuth angle bins by quantizing the azimuth angle values in integer multiples of |angres|. % # Fill each target azimuth bin and neighboring bins with a simulated % radar intensity value. % # Call the |phased.IntensityScope| |step| method to display the scan line. for k = 1:nsteps xradar = radarplatform(dt); xtgts = targets(dt); [rngs,angs] = rangeangle(xtgts,xradar); scanline = zeros(size(angscan)); angindx = ceil((angs(1,1) - angmin)/angres) + 1; idx = angindx + [-1:1]; idx(idx>na)=[]; idx(idx<1)=[]; scanline(idx) = rangegain(rngs(1))/(rngs(1)^4); angindx = ceil((angs(1,2) - angmin)/angres) + 1; idx = angindx + [-1:1]; idx(idx>na)=[]; idx(idx<1)=[]; scanline(idx) = rangegain(rngs(2))/(rngs(2)^4); angindx = ceil((angs(1,3) - angmin)/angres) + 1; idx = angindx + [-1:1]; idx(idx>na)=[]; idx(idx<1)=[]; scanline(idx) = rangegain(rngs(3))/(rngs(3)^4); scope(scanline.'); pause(.1); end