www.pudn.com > radarsignalprocessing.zip > radar_signal_detection.m, change:2015-01-04,size:5021b


% This M-file shows the radar signal detection including MIT, MTD and CFAR. 
 
clear all; 
close all; 
clc; 
 
%------------------------------参数设置------------------------------------------------------------------------------------------------------ 
fr = 200;           % PRI(Hz) 
tr = 1 / fr;        % 导前周期,即脉冲重复周期(s) 
fd1 = 90;           % 动目标1的多普勒频移(Hz) 
fd2 = 140;          % 动目标2的多普勒频移(Hz) 
nRG = 6700;         % 距离门数 
nPRD = 10;          % 导前周期数 
nRF = 11;           % CFAR待检单元每侧的参考单元数 
nPRT = 2;           % CFAR待检单元每侧的保护单元数 
alpha = 2.9;        % CFAR门限因子 
 
%-----------------------------生成nPRD个导前周期,每个导前周期含nRG个距离门的复数据,其中只包含动目标,无杂波------------------------------------------ 
for m = 1 : nPRD 
    movTgt1(m) = 10 * exp(1j * 2 * m * pi * fd1 * tr);        % 第m个导前周期,动目标1在某距离门内的复数据 
    movTgt2(m) = 10 * exp(1j * 2 * m * pi * fd2 * tr);        % 第m个导前周期,动目标2在某距离门内的复数据 
end 
 
x = ones(1, 3);     % 每个动目标占据三个距离点 
n = length(x); 
 
for m = 1 : nPRD 
    rangeGate(m, :) = [[zeros(1, 1700), x, zeros(1, 3400 - 1700 - n)] * movTgt1(m), [zeros(1, 1600), x, zeros(1, nRG - 3400 - 1600 - n)] * movTgt2(m)]; 
                                                              % 第m个导前周期,令动目标1占据1701、1702和1703三个距离门,令动目标2占据第5001、5002和5003三个距离门 
end 
 
%------------------------------生成杂波,并将其加入到各个周期的数据序列,形成回波混合信号-------------------------------------------------------- 
for m = 1 : nPRD 
    clutter_i(m, :) = randn(1, nRG); 
    clutter_q(m, :) = randn(1, nRG); 
    clutter(m, :) = 0.5 * (clutter_i(m, :) + 1j * clutter_q(m, :));   % 杂波复数据 
end 
 
for m = 1 : nPRD 
    echo(m, :) = rangeGate(m, :) + clutter(m, :);                     % 生成回波信号 
end 
 
%------------------------------三脉冲对消(MTI)---------------------------------------------------------------------------------------------- 
for m = 1 : nPRD - 2 
    mtiOut(m, :) = echo(m, :) - 2 * echo(m + 1, :) + echo(m + 2, :);  % 三脉冲对消运算 
end 
 
%------------------------------FFT运算(MTD)------------------------------------------------------------------------------------------------ 
for n = 1 : nRG 
    mtdOut(:, n) = fft(mtiOut(:, n) .* hamming(nPRD - 2, 'periodic'), nPRD - 2);       % N-2点FFT运算 
end 
 
mtd_amplitude = abs(mtdOut);       % MTD各通道直接输出模值 
 
set(0, 'defaultfigurecolor', 'w'); 
for m = 1 : nPRD - 2 
    figure(m + 5); 
    plot(mtd_amplitude(m, :), 'r'); 
    grid on; 
    xlim([0, nRG]); 
    xlabel('距离门'); 
    title(['MTD第 ' num2str(m - 1) ' 通道输出结果']); 
end 
 
%-----------GOCA CFAR--------------------------------------------------------------------------------------------------- 
for m = 1 : nPRD - 2                     % 分别对MTD nPRD-2个通道内的距离门做过门限检测 
     
    z = mtd_amplitude(m, :); 
     
    for n = 1 : 1 + nPRT                 % 待检单元 
        b2(n) = mean(z(n + 1 + nPRT : n + nPRT + nRF));  % 待检单元右侧的参考窗求均值 
        d(n) = b2(n);            
    end 
     
    for n = 1 + nPRT + 1 : nRF + nPRT + 1 
        b1(n) = mean(z(1 : n - 1 - nPRT));                            % 待检单元左侧的参考窗求均值 
        b2(n) = mean(z(n + 1 + nPRT : n + nPRT + nRF)); 
        d(n) = max(b1(n), b2(n));                                     % 两侧参考窗均值选大 
    end 
     
    for n = 1 + nRF + nPRT + 1 : nRG - nRF - nPRT 
        b1(n) = mean(z(n - nPRT - nRF : n - 1 - nPRT)); 
        b2(n) = mean(z(n + 1 + nPRT : nRG)); 
        d(n) = max(b1(n), b2(n)); 
    end 
     
    for n = nRG - nRF - nPRT + 1 : nRG 
        b1(n) = mean(z(n - nPRT - nRF : n - 1 - nPRT)); 
        b2(n) = mean(z(n + 1 + nPRT : nRG)); 
        d(n) = max(b1(n), b2(n)); 
    end 
     
    s_cfar = zeros(1, nRG); 
     
    for n = 1 : nRG 
         
        T(n) = alpha * d(n);                % 第n个距离门的检测门限 
         
        if z(n) > T(n)                       
            s_cfar(n) = z(n) - T(n);        % 若过门限,则将该距离点的数据置为差值 
        end 
    end 
     
    temp(m, :) = s_cfar;                    % 存储各个通道的检测结果 
     
    figure(m + 40); 
    plot(z, 'r'); 
    hold on; 
    plot(T, 'g'); 
    xlabel('距离门'); 
    grid on; 
    xlim([0, nRG]); 
    title(['MTD第 ' num2str(m - 1) ' 通道的门限设定']); 
    legend('混合信号', '门限'); 
     
    figure(m + 80); 
    hold off; 
    plot(s_cfar, 'r'); 
    xlabel('距离门'); 
    grid on ; 
    xlim([0, nRG]); 
    title(['MTD第 ' num2str(m - 1) ' 通道检测结果']); 
end 
 
for  n = 1 : nRG 
    cfar(:, n) = max(temp(:, n));           % 取N-2个通道中的最大值作为该距离点的检测结果 
end 
 
figure(115); 
plot(cfar, 'r'); 
title('GOCA CFAR检测结果'); 
xlabel('距离门');  
xlim([0, nRG]); 
grid on;