Main Content

step

System object: phased.CFARDetector
Namespace: phased

Perform CFAR detection

Syntax

Y = step(H,X,cutidx)
[Y,th] = step(___)
[Y,noise] = step(___)
Y = step(H,X,cutidx,thfac)
[Y,TH,N] = step(H,X,cutidx,thfac)

Description

Note

Starting in R2016b, instead of using the step method to perform the operation defined by the System object™, you can call the object with arguments, as if it were a function. For example, y = step(obj,x) and y = obj(x) perform equivalent operations.

Y = step(H,X,cutidx) performs CFAR detection on specified elements of the input data, X. X can either be a real-valued M-by-1 column vector or a real-valued M-by-N matrix. cutidx is a length-D vector of indices specifying the input elements or cells under test (CUT) on which to perform detection processing. When X is a vector, cutidx specifies the element. When X is a matrix, cutidx specifies the row of the element. The same index applies to all columns of the matrix. Detection is performed independently along each column of X for the indices specified in cutidx. You can specify the input arguments as single or double precision.

The output argument Y contains detection results. The format of Y depends on the OutputFormat property.

  • When OutputFormat is 'Cut result', Y is a D-by-1 vector or a D-by-N matrix containing logical detection results. D is the length of cutidx and N is the number of columns of X. The rows of Y correspond to the rows in cutidx. For each row, Y contains 1 in a column if there is a detection in the corresponding column of X. Otherwise, Y contains a 0.

  • When OutputFormat is 'Detection index', Y is a 1-by-L vector or a 2-by-L matrix containing detections indices. L is the number of detections found in the input data. When X is a column vector, Y contains the index for each detection in X. When X is a matrix, Y contains the row and column indices of each detection in X. Each column of Y has the form [detrow;detcol]. When the NumDetectionsSource property is set to 'Property', L equals the value of the NumDetections property. If the number of actual detections is less than this value, columns without detections are set to NaN.

The size of the first dimension of the input matrix can vary to simulate a changing signal length. A size change can occur, for example, in the case of a pulse waveform with variable pulse repetition frequency.

[Y,th] = step(___) also returns the detection threshold, th, applied to detected cells under test.

  • When OutputFormat is 'CUT result', th also returns the detection threshold th.

  • When OutputFormat is 'Detection index', th returns a detection threshold for each corresponding detection in Y. When the NumDetectionsSource property is set to 'Property', L equals the value of the NumDetections property. If the number of actual detections is less than this value, columns without detections are set to NaN.

To enable this syntax, set the ThresholdOutputPort property to true.

[Y,noise] = step(___) also returns the estimated noise power, noise, for each detected cell under test in X.

  • When OutputFormat is 'CUT result', noise returns a noise power estimate.

  • When OutputFormat is 'Detection index', noise returns a noise power estimate for each corresponding detection in Y. When the NumDetectionsSource property is set to 'Property', L equals the value of the NumDetections property. If the number of actual detections is less than this value, columns without detections are set to NaN.

To enable this syntax, set the NoisePowerOutputPort property to true.

Y = step(H,X,cutidx,thfac), in addition, specifies thfac as the threshold factor used to calculate the detection threshold. thfac must be a positive scalar. To enable this syntax, set the ThresholdFactor property to 'Input port'.

You can combine optional input and output arguments when their enabling properties are set. Optional inputs and outputs must be listed in the same order as the order of the enabling properties. For example, [Y,TH,N] = step(H,X,cutidx,thfac).

Note

The object performs an initialization the first time the object is executed. This initialization locks nontunable properties and input specifications, such as dimensions, complexity, and data type of the input data. If you change a nontunable property or an input specification, the System object issues an error. To change nontunable properties or inputs, you must first call the release method to unlock the object.

Examples

expand all

Perform cell-averaging CFAR detection on a given Gaussian noise vector with a desired probability of false alarm (pfa) of 0.1. Assume that the data comes from a square law detector and no pulse integration is performed. Use 50 cells to estimate the noise level and 1 cell to separate the test cell and training cells. Perform the detection on all cells of the input.

detector = phased.CFARDetector('NumTrainingCells',50,...
    'NumGuardCells',2,'ProbabilityFalseAlarm',0.1);
N = 1000;
x = 1/sqrt(2)*(randn(N,1) + 1i*randn(N,1));
dets = detector(abs(x).^2,1:N);
pfa = sum(dets)/N
pfa = 0.1140

Perform cell-averaging CFAR detection on a given Gaussian noise vector with a desired probability of false alarm (pfa) of 0.005. Assume that the data comes from a square law detector and no pulse integration is performed. Perform the detection on all cells of the input. Use 50 cells to estimate the noise level and 1 cell to separate the test cell and training cells. Display the detection indices.

rng default;
detector = phased.CFARDetector('NumTrainingCells',50,'NumGuardCells',2, ...
    'ProbabilityFalseAlarm',0.005,'OutputFormat','Detection index');
N = 1000;
x1 = 1/sqrt(2)*(randn(N,1) + 1i*randn(N,1));
x2 = 1/sqrt(2)*(randn(N,1) + 1i*randn(N,1));
x = [x1,x2];
cutidx = 1:N;
dets = detector(abs(x).^2,cutidx)
dets = 2×11

   339   537   538   734   786   827   979   136   418   539   874
     1     1     1     1     1     1     1     2     2     2     2

Algorithms

phased.CFARDetector uses cell averaging in three steps:

  1. Identify the training cells from the input, and form the noise estimate. The next table indicates how the detector forms the noise estimate, depending on the Method property value.

    MethodNoise Estimate
    'CA'Use the average of the values in all the training cells.
    'GOCA'Select the greater of the averages in the front training cells and rear training cells.
    'OS'Sort the values in the training cells in ascending order. Select the Nth item, where N is the value of the Rank property.
    'SOCA'Select the smaller of the averages in the front training cells and rear training cells.
  2. Multiply the noise estimate by the threshold factor to form the threshold.

  3. Compare the value in the test cell against the threshold to determine whether the target is present or absent. If the value is greater than the threshold, the target is present.

For details, see [1].

References

[1] Richards, M. A. Fundamentals of Radar Signal Processing. New York: McGraw-Hill, 2005.