%% ================ 雷达系统参数设置 ================
% 基本参数
pd = 0.9; % 检测概率
pfa = 1e-6; % 虚警概率
max_range = 20000; % 最大探测距离 (m)
tgt_rcs = 1.5; % 目标RCS (m²)
int_pulsenum = 10; % 积累脉冲数
B=7.5e6;
fs = B; % 采样率 (Hz)
prf = 7500; % 脉冲重复频率 (Hz)
pulse_width = 10e-6; % 脉冲宽度 (s)
fc = 10e9; % 载波频率 (Hz)
v = physconst('LightSpeed'); % 传播速度 (m/s)
lambda = v/fc; % 波长 (m)
%% ================ 系统组件初始化 ================
% 1. 波形发生器
load BasicMonostaticRadarExampleData;
waveform = phased.LinearFMWaveform(...
'SampleRate', fs,...
'PRF', prf,...
'PulseWidth', pulse_width,...
'SweepBandwidth', B,...
'SweepDirection', 'Up',...
'SweepInterval', 'Positive');
% 2. 天线阵列
antenna = phased.IsotropicAntennaElement(...
'FrequencyRange', [0.8*fc 1.2*fc],...
'BackBaffled', true);
ura = phased.URA(...
'Element', antenna,...
'Size', [25 25],...
'ElementSpacing', [lambda/2 lambda/2]);
% 3. 发射机
array_gain_db = 10*log10(25*25); % 阵列增益
snr_min = albersheim(pd, pfa, int_pulsenum);
noise_power = noisepow(1/waveform.PulseWidth); % 噪声系数3dB, 290K参考温度
peak_power = ((4*pi)^3 * noise_power * max_range^4 * db2pow(snr_min)) / ...
(db2pow(2*(array_gain_db+20)) * tgt_rcs * lambda^2);
transmitter = phased.Transmitter(...
'PeakPower', peak_power/625,...
'Gain', 20,...
'LossFactor', 0,...
'InUseOutputPort', true,...
'CoherentOnTransmit', true);
% 4. 接收机
receiver = phased.ReceiverPreamp(...
'SampleRate', fs,...
'Gain', 20,...
'NoiseFigure', 0,...
'ReferenceTemperature', 290,...
'EnableInputPort', true,...
'SeedSource', 'Property',...
'Seed', 2023);
% 5. 辐射器和收集器
radiator = phased.Radiator(...
'Sensor', ura,...
'OperatingFrequency', fc,...
'PropagationSpeed', v,...
'CombineRadiatedSignals', true,...
'WeightsInputPort', true);
collector = phased.Collector(...
'Sensor', ura,...
'OperatingFrequency', fc,...
'PropagationSpeed', v,...
'Wavefront', 'Plane');
%% ================ 目标模型参数设置 ================
tgtpos = [[13500*cosd(2);13500*sind(2); 0],[13530*cosd(2);13530*sind(2); 0],[13470*cosd(2);13470*sind(2); 0],[18000*cosd(2); 18000*sind(2); 0],[18030*cosd(2); 18030*sind(2); 0],[179700*cosd(2); 17970*sind(2); 0]];
tgtvel = [[-450*cosd(2);-450*sind(2); 0],[-450*cosd(2); -450*sind(2); 0],[-450*cosd(2);-450*sind(2); 0],[-450*cosd(6);-450*sind(6); 0],[-450*cosd(6);-450*sind(6); 0],[-450*cosd(6);-450*sind(6); 0]];
tgtmotion = phased.Platform('InitialPosition',tgtpos,'Velocity',tgtvel);
tgtrcs = [1.5 1.5 1.5 1.5 1.5 1.5];
target = phased.RadarTarget('MeanRCS',tgtrcs,'OperatingFrequency',fc);
% Calculate the range, angle, and speed of the targets
[tgtrng,tgtang] = rangeangle(tgtmotion.InitialPosition,...
sensormotion.InitialPosition);
numtargets = length(target.MeanRCS);
%% ================ 目标模型初始化 ================
tgtmotion = phased.Platform('InitialPosition', tgtpos, 'Velocity', tgtvel);
target = phased.RadarTarget('MeanRCS', tgtrcs, 'OperatingFrequency', fc);
% 7. 传播信道
channel = phased.FreeSpace(...
'SampleRate', fs,...
'TwoWayPropagation', true,...
'OperatingFrequency', fc);
% 8. 波束形成组件
steeringvec = phased.SteeringVector(...
'SensorArray', ura,...
'PropagationSpeed', v);
beamformer = phased.PhaseShiftBeamformer(...
'SensorArray', ura,...
'OperatingFrequency', fc,...
'PropagationSpeed', v,...
'DirectionSource', 'Input port');
% 9. 雷达平台
sensormotion = phased.Platform(...
'InitialPosition', [0; 0; 0],...
'Velocity', [0; 0; 0]);
%% ================ 扫描参数设置 ================
initialAz = 60; % 起始方位角 (度)
endAz = -60; % 结束方位角 (度)
scanstep = -4; % 扫描步长 (度) 负值表示从右向左扫描
% 确保扫描范围正确
if initialAz < endAz
% 如果起始角度小于结束角度,交换值
[initialAz, endAz] = deal(endAz, initialAz);
scanstep = -scanstep; % 反转扫描方向
end
% 计算扫描网格
scangrid = initialAz-2 : scanstep : endAz+2;
numscans = length(scangrid);
disp(['扫描角度范围: ', num2str(scangrid(1)), '° 到 ', num2str(scangrid(end)), '°']);
disp(['扫描步数: ', num2str(numscans), ' (步长: ', num2str(scanstep), '°)']);
disp(['每个波位脉冲数: ', num2str(int_pulsenum)]);
pulsenum = int_pulsenum * numscans; % 总脉冲数
revisitTime = pulsenum / prf; % 扫描周期
% 计算每个PRI的采样点数
pri = 1 / prf; % 脉冲重复间隔
samples_per_pri = round(pri * fs); % 3000 (22.5e6 / 7500)
fast_time_grid = (0:samples_per_pri-1)/fs; % 快时间网格
% 预分配接收信号矩阵
rxpulses = zeros(samples_per_pri, pulsenum);
% Calculate the range, angle, and speed of the targets
[tgtrng,tgtang] = rangeangle(tgtmotion.InitialPosition,...
sensormotion.InitialPosition);
numtargets = length(target.MeanRCS);
% 创建导向矢量和波束形成器
steeringvec = phased.SteeringVector('SensorArray',ura,...
'PropagationSpeed',v);%计算不同方向上的相位偏移权重
%创建接收端的波束形成器
beamformer = phased.PhaseShiftBeamformer('SensorArray',ura,...
'OperatingFrequency',fc,'PropagationSpeed',v,...
'DirectionSource','Input port');%
% 定义传播信道
channel = phased.FreeSpace(...
'SampleRate',fs,...
'TwoWayPropagation',true,...
'OperatingFrequency',fc);
fast_time_grid = unigrid(0, 1/fs, 1/prf, '[)');
% 预分配接收信号矩阵
rxpulses = zeros(numel(fast_time_grid),pulsenum);%作用:预分配内存存储接收到的脉冲信号
for m = 1:pulsenum
% 更新平台和目标位置
[sensorpos,sensorvel] = sensormotion(1/prf); %调用运动模型函数更新雷达平台和目标位置/速度
[tgtpos,tgtvel] = tgtmotion(1/prf); %时间步长 = 1/PRF(脉冲重复间隔)
% 计算目标相对参数
[tgtrng,tgtang] = rangeangle(tgtpos,sensorpos); %计算目标相对雷达的距离角度[方位角; 俯仰角]
% 计算当前扫描角度和波束权重
scanid = floor((m-1)/int_pulsenum) + 1;
sv = steeringvec(fc,scangrid(scanid));
w = conj(sv);
% 生成和发射脉冲
pulse = waveform();
[txsig,txstatus] = transmitter(pulse);
txsig = radiator(txsig,tgtang,w);
txsig = channel(txsig,sensorpos,tgtpos,sensorvel,tgtvel);
% 信号传播和目标反射
tgtsig = target(txsig);
% 接收和处理回波信号
rxsig = collector(tgtsig,tgtang);
rxsig = receiver(rxsig,~(txstatus>0));
rxpulses(:,m) = 625*beamformer(rxsig,[scangrid(scanid);0]);
end
%% ================ Matched filtering ================
% Matched filtering
matchingcoeff = getMatchedFilter(waveform);
matchedfilter = phased.MatchedFilter(...
'Coefficients',matchingcoeff,...
'GainOutputPort',true);
[mf_pulses, mfgain] = matchedfilter(rxpulses);
mf_pulses = reshape(mf_pulses,[],int_pulsenum,numscans);
matchingdelay = size(matchingcoeff,1)-1;
sz_mfpulses = size(mf_pulses);
mf_pulses = [mf_pulses(matchingdelay+1:end) zeros(1,matchingdelay)];
mf_pulses = reshape(mf_pulses,sz_mfpulses);
% Pulse integration
int_pulses = pulsint(mf_pulses,'noncoherent');
int_pulses = squeeze(int_pulses);
% Visualize
r = v*fast_time_grid/2;
X = r'*cosd(scangrid); Y = r'*sind(scangrid);
clf;
pcolor(X,Y,pow2db(abs(int_pulses).^2));
axis equal tight
shading interp
axis off
text(-800,0,'Array');
text((max(r)+10)*cosd(initialAz),(max(r)+10)*sind(initialAz),...
[num2str(initialAz) '^o']);
text((max(r)+10)*cosd(endAz),(max(r)+10)*sind(endAz),...
[num2str(endAz) '^o']);
text((max(r)+10)*cosd(0),(max(r)+10)*sind(0),[num2str(0) '^o']);
colorbar;
%% ================Detection and Range Estimation================
range_gates = v*fast_time_grid/2;
tvg = phased.TimeVaryingGain(...
'RangeLoss',2*fspl(range_gates,lambda),...
'ReferenceLoss',2*fspl(max(range_gates),lambda));
tvg_pulses = tvg(mf_pulses);
% Pulse integration
int_pulses = pulsint(tvg_pulses,'noncoherent');
int_pulses = squeeze(int_pulses);
% Calculate the detection threshold
% sample rate is twice the noise bandwidth in the design system
noise_bw = receiver.SampleRate/2;
npower = noisepow(noise_bw,...
receiver.NoiseFigure,receiver.ReferenceTemperature);
threshold = npower * db2pow(npwgnthresh(pfa,int_pulsenum,'noncoherent'));
% Increase the threshold by the matched filter processing gain
threshold = threshold * db2pow(mfgain)*625;
N = 51;
clf;
surf(X(N:end,:),Y(N:end,:),...
pow2db(abs(int_pulses(N:end,:)).^2));
hold on;
mesh(X(N:end,:),Y(N:end,:),...
pow2db(threshold*ones(size(X(N:end,:)))),'FaceAlpha',0.8);
view(0,56);
axis off
[~,peakInd] = findpeaks(int_pulses(:),'MinPeakHeight',sqrt(threshold));
[rngInd,angInd] = ind2sub(size(int_pulses),peakInd);
est_range = range_gates(rngInd); % Estimated range
est_angle = scangrid(angInd); % Estimated direction
在以上代码的基础上,生成匹配滤波峰值输出、目标位置及速度参数估计代码
最新发布