雷达恒虚警检测算法处理程序,可以直接使用
单片机源程序如下:
- function OCor=CFAR(data)
- %edit by yaochen 2016/12/19 SOCA CFAR detection
- %解决CA CFAR方法中目标遮蔽效应问题,SOCA CFAR对于杂波边缘处理不好
- %-------------------------------------
- %1-D CFAR detection,
- %input data format:1*N
- NGC=400;%Num Guard Cells
- NTC=800;%Num Training Cells
- exp_pfa = 1e-8;%expection of Pfa
- nPoint = length(data);
- n=0;
- OCor=[];
- x = abs(data).^2;%signal after a square law detector
- Odata=zeros(nPoint,1);
- T=zeros(1,nPoint);
- for iPoint=1:nPoint
- CI=iPoint;%cell under test
- CIF=CI-NGC/2-1;%cell index forward
- CIB=CI+NGC/2+1;%cell index backward
- if CIF>=1
- if CIF-NTC/2+1>=1
- FIdx=[(CIF-NTC/2+1):CIF];
- else
- FIdx=[1:CIF];
- end
- else
- FIdx=[];
- end
-
- if CIB<=nPoint
- if CIB+NTC/2-1<=nPoint
- BIdx=[CIB:(CIB+NTC/2-1)];
- else
- BIdx=[CIB:nPoint];
- end
- else
- BIdx=[];
- end
-
- N1=size(BIdx,2);
- N2=size(FIdx,2);
- if N1>0 && N2>0
- np_e1=sum(x(BIdx))/N1;
- alpha1=N1*(exp_pfa^(-1/N1)-1);
- T1=alpha1*np_e1;
-
- np_e2=sum(x(FIdx))/N2;
- alpha2=N2*(exp_pfa^(-1/N2)-1);
- T2=alpha2*np_e2;
- T(iPoint)=min(T1,T2);
- else
- N=(size(BIdx,2)+size(FIdx,2));
- np_e=(sum(x(BIdx))+sum(x(FIdx)))/N;
- alpha=N*(exp_pfa^(-1/N)-1);
- T(iPoint)=alpha*np_e;
- end
- if(x(iPoint)>T(iPoint))%here must be >;consider >=,when there is no noise, x =T
- n=n+1;
- OCor(1,n)=1;
- OCor(2,n)=iPoint;
- Odata(iPoint)=1;
- else
- Odata(iPoint)=0;
- end
-
- end
- % figure(2)
- % plot(abs(Odata*max(tempData)),'r')
- % hold on;
- % plot(abs(tempData));
- %
- % hold off;
- % pause(0.1);
- % if isempty(oCor)
- % OCor=[];
- % end
- end
复制代码
所有资料51hei提供下载:
CFAR.zip
(986 Bytes, 下载次数: 7)
|