From 34c17ce82a437c29ad0ce9a8e43ae67116feef9b Mon Sep 17 00:00:00 2001 From: Nicole Date: Sun, 6 Sep 2020 15:20:13 +0800 Subject: [PATCH] CFAR MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit CFAR鏂规硶瀹炵幇 --- GO_CFAR.m | 81 +++++++++++++++++++++++++++++++++++++++++++++++++ OS_CFAR.m | 72 ++++++++++++++++++++++++++++++++++++++++++++ OS_Pd_Fun.m | 4 +++ SO_CFAR.m | 86 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 243 insertions(+) create mode 100644 GO_CFAR.m create mode 100644 OS_CFAR.m create mode 100644 OS_Pd_Fun.m create mode 100644 SO_CFAR.m diff --git a/GO_CFAR.m b/GO_CFAR.m new file mode 100644 index 0000000..b1347d4 --- /dev/null +++ b/GO_CFAR.m @@ -0,0 +1,81 @@ +% GO-CFAR干扰目标背景下检测性能仿真- +clc;clear all;close all; +N=36; %参考单元长度 +n=N/2; %半滑窗长度 +M=1e4; %蒙特卡洛仿真次数 +SNR_dB=5:1:35; %信噪比 +SNR=10.^(SNR_dB./10); +Simul_len=length(SNR); %仿真长度 +T=0.8551; +Pd_GO1=0; +for i=1:length(SNR) + count=0; + for j=1:M + %%%%%%%%%%%产生指数噪声%%%%%%%%%%%%%%%%%%%%%%% + lambda=1; + u=rand(1,N-1); + exp_noise=log(u)*(-lambda); + %%%%%%%%%%%%产生目标回波%%%%%%%%%%%%%%%%%%% + lambda=SNR(i)+1; + u=rand(1,2); + exp_target=log(u(1))*(-lambda); + exp_noise(N)=log(u(2))*(-lambda); + cfar_k=exp_target/max(sum(exp_noise(1:N/2)),sum(exp_noise((N/2+1):N))); + if (cfar_k>T) + count=count+1; + end + end + Pd_GO1(i)=count/M; +end +figure; +plot(SNR_dB,Pd_GO1,'b--','LineWidth',1.5); +hold on +Pd_GO2=0; +for i=1:length(SNR) + count=0; + for j=1:M + %%%%%%%%%%%产生指数噪声%%%%%%%%%%%%%%%%%%%%%%% + lambda=1; + u=rand(1,N-2); + exp_noise=log(u)*(-lambda); + %%%%%%%%%%%%产生目标回波%%%%%%%%%%%%%%%%%%% + lambda=SNR(i)+1; + u=rand(1,3); + exp_target=log(u(1))*(-lambda); + exp_noise(N)=log(u(2))*(-lambda); + exp_noise(N-1)=log(u(3))*(-lambda); + cfar_k=exp_target/max(sum(exp_noise(1:N/2)),sum(exp_noise((N/2+1):N))); + if (cfar_k>T) + count=count+1; + end + end + Pd_GO2(i)=count/M; +end +plot(SNR_dB,Pd_GO2,'r--*','LineWidth',1.5); +hold on +Pd_GO3=0; +for i=1:length(SNR) + count=0; + for j=1:M + %%%%%%%%%%%产生指数噪声%%%%%%%%%%%%%%%%%%%%%%% + lambda=1; + u=rand(1,N-2); + exp_noise=log(u)*(-lambda); + %%%%%%%%%%%%产生目标回波%%%%%%%%%%%%%%%%%%% + lambda=SNR(i)+1; + u=rand(1,3); + exp_target=log(u(1))*(-lambda); + exp_noise(N)=log(u(2))*(-lambda); + exp_noise(N-1)=log(u(3))*(-lambda); + exp_noise=[exp_noise(1:n-1) exp_noise(N-1) exp_noise(n:N-1) exp_noise(N)]; + cfar_k=exp_target/max(sum(exp_noise(1:N/2)),sum(exp_noise((N/2+1):N))); + if (cfar_k>T) + count=count+1; + end + end + Pd_GO3(i)=count/M; +end +plot(SNR_dB,Pd_GO3,'g-.','LineWidth',1.5); +xlabel('信噪比(dB)');ylabel('检测概率'); +title('干扰目标情况下GO-CAFR检测概率N=36,Pf=1e-6'); +legend('r=(0,1)','r=(0,2)','r=(1,1)'); diff --git a/OS_CFAR.m b/OS_CFAR.m new file mode 100644 index 0000000..e6992ef --- /dev/null +++ b/OS_CFAR.m @@ -0,0 +1,72 @@ +%-OS-CFAR检测器均匀背景与杂波干扰目标背景下性能仿真- +clc; +clear all; +N=32; + +r=3; %CMLD_CFAR检测器筛除掉r个较大的参考样本单元 +R=N-r; %参考单元长度 +n=N/2; %半滑窗长度 +k=3*N/4; +T=16.2933; %标称系数 +Pfa=1e-6; %虚警概率 +syms T0 +g=Pfa-k*nchoosek(R,k)*gamma(R-k+1+T0)*gamma(k)/gamma(R+T0+1); +x=solve(g); +T0=double(x); +M=1e4; %蒙特卡洛仿真次数 +SNR_dB=5:1:35; %信噪比 +SNR=10.^(SNR_dB./10); +Simul_len=length(SNR); %仿真长度 + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%OS-CFAR ideal%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +for i=1:Simul_len + Pd(i)=OS_Pd_Fun(N,k,T,SNR(i)); +end +plot(SNR_dB,Pd,'b'); +hold on +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%OS-CFAR simulation%%%%%%%%%%%%%%%%%%%%%%%% +for i=1:Simul_len + count=0; + for j=1:M + lambda=1; %产生噪声,长度为N + u=rand(1,N); + exp_noise=log(u)*(-lambda); + lambda=SNR(i); %产生待检测单元 + u=rand(1,2); + CUT=log(u(1))*(-lambda); + exp_noise(N)=log(u(2))*(-lambda); + exp_noise=sort(exp_noise); + if(CUT>T*exp_noise(k)) + count=count+1; + end + end + Pd_sim(i)=count/M; +end +plot(SNR_dB,Pd_sim,'-*r'); +hold on +%%%%%%%%%%%%%%%CMLD_CFAR检测器筛除掉r个较大的参考样本单%%%%%%%%%%%%%%%%%% +for i=1:Simul_len + count=0; + for j=1:M + lambda=1; %产生噪声,长度为N-1 + u=rand(1,N-1); + exp_noise(1:N-1)=log(u)*(-lambda); + + lambda=SNR(i); %产生待检测单元及一个干扰目标 + u=rand(1,2); + CUT=log(u(1))*(-lambda); + exp_noise(N)=log(u(2))*(-lambda); + exp_noise=sort(exp_noise); + exp_noise1(1:N-r)=exp_noise(1:N-r); + if(CUT>T0*exp_noise1(k)) + count=count+1; + end + end + Pd_sim_1(i)=count/M; +end +plot(SNR_dB,Pd_sim_1,'--g'); +hold on + +title('OS-CFAR 检测概率曲线,N=32,Pf=1e-6'); +xlabel('信噪比(dB)');ylabel('检测概率'); +legend('OS-ideal','OS-simulation','OS-1interference'); \ No newline at end of file diff --git a/OS_Pd_Fun.m b/OS_Pd_Fun.m new file mode 100644 index 0000000..744b95c --- /dev/null +++ b/OS_Pd_Fun.m @@ -0,0 +1,4 @@ +function [Pd]=OS_Pd_Fun(R,k,T,lammbd) +%计算OS-CFAR的检测概率 +%输入参数位R:参考单元数据,k:选取第k个排序值作为背景估计值,lammbd:信噪比,T:检测门限 +Pd=k*nchoosek(R,k)*gamma(R-k+1+T/(1+lammbd))*gamma(k)/gamma(R+T/(1+lammbd)+1); \ No newline at end of file diff --git a/SO_CFAR.m b/SO_CFAR.m new file mode 100644 index 0000000..37e2762 --- /dev/null +++ b/SO_CFAR.m @@ -0,0 +1,86 @@ +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% 干扰目标情况下SO-CAFR检测概率N=32,Pf=1e-6 +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +clc;clear all;close all; +N=36; %参考单元长度 +n=N/2; %半滑窗长度 +M=1e4; %蒙特卡洛仿真次数 +SNR_dB=5:1:35; %信噪比 +SNR=10.^(SNR_dB./10); +Simul_len=length(SNR); %仿真长度 +T=1.2379; +Pd_SO1=0; +%%%%%%%%%%%%%%%%%%%%%%%%%%%1干扰目标%%%%%%%%%%%%%%%%%%% +for i=1:length(SNR) + count=0; + for j=1:M + %%%%%%%%%%%产生指数噪声%%%%%%%%%%%%%%%%%%%%%%% + lambda=1; + u=rand(1,N-1); + exp_noise=log(u)*(-lambda); + %%%%%%%%%%%%产生目标回波%%%%%%%%%%%%%%%%%%% + lambda=SNR(i)+1; + u=rand(1,2); + exp_target=log(u(1))*(-lambda); + exp_noise(N)=log(u(2))*(-lambda); + cfar_k=exp_target/min(sum(exp_noise(1:N/2)),sum(exp_noise((N/2+1):N))); + if (cfar_k>T) + count=count+1; + end + end + Pd_SO1(i)=count/M; +end +figure; +plot(SNR_dB,Pd_SO1,'b--','LineWidth',1.5); +hold on +Pd_SO2=0; +%%%%%%%%%%%%%%%%%%%%%%%%后半参考滑窗包含2干扰目标%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +for i=1:length(SNR) + count=0; + for j=1:M + %%%%%%%%%%%产生指数噪声%%%%%%%%%%%%%%%%%%%%%%% + lambda=1; + u=rand(1,N-2); + exp_noise=log(u)*(-lambda); + %%%%%%%%%%%%产生目标回波%%%%%%%%%%%%%%%%%%% + lambda=SNR(i)+1; + u=rand(1,3); + exp_target=log(u(1))*(-lambda); + exp_noise(N)=log(u(2))*(-lambda); + exp_noise(N-1)=log(u(3))*(-lambda); + cfar_k=exp_target/min(sum(exp_noise(1:N/2)),sum(exp_noise((N/2+1):N))); + if (cfar_k>T) + count=count+1; + end + end + Pd_SO2(i)=count/M; +end +plot(SNR_dB,Pd_SO2,'r--*','LineWidth',1.5); +hold on +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%前后半参考滑窗各包含1干扰目标%%%%%%%%%%%%%% +Pd_SO3=0; +for i=1:length(SNR) + count=0; + for j=1:M + %%%%%%%%%%%产生指数噪声%%%%%%%%%%%%%%%%%%%%%%% + lambda=1; + u=rand(1,N-2); + exp_noise=log(u)*(-lambda); + %%%%%%%%%%%%产生目标回波%%%%%%%%%%%%%%%%%%% + lambda=SNR(i)+1; + u=rand(1,3); + exp_target=log(u(1))*(-lambda); + exp_noise(N)=log(u(2))*(-lambda); + exp_noise(N-1)=log(u(3))*(-lambda); + exp_noise=[exp_noise(1:n-1) exp_noise(N-1) exp_noise(n:N-1) exp_noise(N)]; + cfar_k=exp_target/min(sum(exp_noise(1:N/2)),sum(exp_noise((N/2+1):N))); + if (cfar_k>T) + count=count+1; + end + end + Pd_SO3(i)=count/M; +end +plot(SNR_dB,Pd_SO3,'g-.','LineWidth',1.5); +title('干扰目标情况下CA-CAFR检测概率N=36,Pf=1e-6'); +legend('r=(0,1)','r=(0,2)','r=(1,1)'); +xlabel('信噪比(dB)');ylabel('检测概率'); \ No newline at end of file