CFAR Algorithm showing incorrect results

5 次查看(过去 30 天)
I am trying to implement CFAR algorithm on the fft of a signal x=sin(2*pi*f1*t)+sin(2*pi*f2*t) where f1=128Hz,f2=250 Hz and fs=2^15Hz and N=2^10. However as the peaks corresponding to f1 and f2 have edges along its length,erroneous detection is made even at the edges.What could be a possible solution to this problem? The points circled in black are erroneous detections.

回答(1 个)

Honglei Chen
Honglei Chen 2017-1-12
编辑:Honglei Chen 2017-1-12
I don't know what CFAR algorithm you use, but if you just need the peak, you can simply use findpeaks function.
According to you description, I'm modeling your signal as
f1 = 128; f2 = 250; fs = 2^15; N = 2^10;
t = (0:N-1)/fs;
x = sin(2*pi*f1*t)+sin(2*pi*f2*t);
Xf = mag2db(abs(fft(x)));
f = (0:N-1)/N*fs;
Np = 16; Xf1 = Xf(1:Np); f1 = f(1:Np); % I'll use first 16 points as an example
plot(f1,Xf1,'-*');
Based on your figure, if you simply use findpeaks with a threshold of 40, you should be able to detect only two peaks
findpeaks(Xf1,'MinPeakHeight',40)
Alternatively, if you really want to use CFAR and you have access to Phased Array System Toolbox, you can do something like
cfar = phased.CFARDetector('NumTrainingCells',4,'ProbabilityFalseAlarm',0.3);
ispeak = step(cfar,Xf1(:),1:Np).';
where ispeak represents whether the corresponding entry in Xf1 is a peak. However, the result for a CFAR detector is sensitive to the false alarm rate you set in the detector. In your problem, it seems that you don't have any noise. In that case, I'd say findpeaks is more appropriate.
HTH

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by