CFARDectector2D Error using fzero: Initial function value must be finite and real.

2 views (last 30 days)
Hi,
I am trying to create a CFAR range Doppler map for FMCW radar.
Offending code:
cutidx = [];
for m = 1:n_sweeps
for n = 1:n_samples
cutidx = [cutidx,[n;m]];
end
end
ncutcells = size(cutidx,2)
[up_detections, upth] = CFAR(abs(fftshift(IQ2D)), cutidx);
My 2D FFT result is IQ2D, dimensions 200 samples x 512 sweeps. I set up the cutidx as shown in the example. Transposing the input has no effect on the error:
Error using fzero
Initial function value must be finite and real.
Error in phased.internal.AbstractDetector/calcWGNThresholdFactor (line 353)
alpha = abs(fzero(@(x)SOCAWGNThresholdFactor(abs(x)),cast(CAThreshold,'double')));
Error in phased.internal.AbstractDetector/setupImpl (line 216)
obj.pFactor = calcWGNThresholdFactor(obj);
Error in phased.CFARDetector2D/setupImpl (line 243)
setupImpl@phased.internal.AbstractDetector(obj);
Error in cfar_rd_sawtooth (line 80)
[up_detections, upth] = CFAR(abs(fftshift(IQ2D)), cutidx);
Please find script and data attached.

Accepted Answer

Dayalan Nair
Dayalan Nair on 5 Jul 2022
The issue was that the cells under test must be training + guard cells away from the edges of the data set

More Answers (0)

Products


Release

R2022a

Community Treasure Hunt

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

Start Hunting!