Main Content

phased.CFARDetector

Constant false alarm rate (CFAR) detector

Description

The CFARDetector object implements a one-dimensional constant false-alarm rate (CFAR) detector. Detection processing is performed on selected elements (called cells) of the input data. A detection is declared when a cell value in the input data exceeds a threshold. To maintain a constant false alarm-rate, the threshold is set to a multiple of the local noise power of the input data. The detector estimates local noise power for a cell-under-test (CUT) from surrounding cells using one of three cell averaging methods, or an order statistics method. The cell-averaging methods are cell averaging (CA), greatest-of cell averaging (GOCA), or smallest-of cell averaging (SOCA).

For more information about CFAR detectors, see [1].

For each test cell, the detector:

  1. Estimates the noise statistic from the cell values in the training band surrounding the CUT cell.

  2. Computes the threshold by multiplying the noise estimate by the threshold factor.

  3. Compares the CUT cell value to the threshold to determine whether a target is present or absent. If the value is greater than the threshold, a target is present.

detector = phased.CFARDetector creates a CFAR detector System object™, detector. The object performs CFAR detection on input data.

To run the detector:

  1. Create the phased.CFARDetector object and set its properties.

  2. Call the object with arguments, as if it were a function.

To learn more about how System objects work, see What Are System Objects?

Creation

Description

example

detector = phased.CFARDetector creates the object, detector. The object performs CFAR detection on input data.

example

detector = phased.CFARDetector(Name,Value) creates the object, detector, with each specified property Name set to the specified Value. You can specify additional name-value pair arguments in any order as (Name1,Value1,...,NameN,ValueN).

Properties

expand all

Unless otherwise indicated, properties are nontunable, which means you cannot change their values after calling the object. Objects lock when you call them, and the release function unlocks them.

If a property is tunable, you can change its value at any time.

For more information on changing property values, see System Design in MATLAB Using System Objects.

Specify the CFAR averaging method as one of

Averaging MethodDescription
CA — Cell-averaging algorithm

Computes the sample mean of all training cells surrounding the CUT cell.

GOCA — Greatest-of cell-averaging algorithm

Splits the training window surrounding the CUT cell into left and right halves. Then, the algorithm computes the sample mean for each half and selects the largest mean.

SOCA — Smallest-of cell-averaging algorithm

Splits the training window surrounding the CUT cell into left and right halves. Then, the algorithm computes the sample mean for each half and selects the smallest mean.

OS — Order statistic algorithm

Sorts training cells in ascending order of numeric values. Then the algorithm selects the kth value from the list. k is the rank specified by the Rank parameter.

Example: 'OS'

Data Types: char

Specify the rank of the order statistic as a positive integer scalar. The value must be less than or equal to the value of the NumTrainingCells property. A value of 1 selects the smallest value in the training region. This property applies only when you set the Method property to 'OS'.

Example: 3

Data Types: single | double

Specify the number of guard cells used in training as an even integer. This property specifies the total number of cells on both sides of the cell under test.

Data Types: single | double

Specify the number of training cells used in training as an even integer. Whenever possible, the training cells are equally divided before and after the cell under test.

Data Types: single | double

Specify whether the threshold factor comes from an automatic calculation, the CustomThresholdFactor property of this object, or an input argument in the object function. Values of this property are:

'Auto'The application calculates the threshold factor automatically based on the desired probability of false alarm specified in the ProbabilityFalseAlarm property. The calculation assumes each independent signal in the input is a single pulse coming out of a square law detector with no pulse integration. The calculation also assumes the noise is white Gaussian.
'Custom'The CustomThresholdFactor property of this object specifies the threshold factor.
'Input port'An input argument in the object function specifies the threshold factor.

Data Types: char

Specify the desired probability of false alarm as a scalar between 0 and 1 (not inclusive). This property applies only when you set the ThresholdFactor property to 'Auto'.

Example: 0.001

Data Types: double

Specify the custom threshold factor as a positive scalar. This property applies only when you set the ThresholdFactor property to 'Custom'. This property is tunable.

Data Types: single | double

Format of detection results returned by the object function method, specified as 'CUT result' or 'Detection index'.

  • When set to 'CUT result', the results are logical detection values (1 or 0) for each tested cell.

  • When set to 'Detection index', the results form a vector or matrix containing the indices of tested cells that exceed a detection threshold. You can use this format as input to the phased.RangeEstimator and phased.DopplerEstimator System objects.

Data Types: char

To obtain the detection threshold, set this property to true and use the corresponding output argument when invoking the object function. If you do not want to obtain the detection threshold, set this property to false.

Data Types: logical

To obtain the estimated noise, set this property to true and use the corresponding output argument when invoking the object function. If you do not want to obtain the estimated noise, set this property to false.

Data Types: logical

Source of the number of detections, specified as 'Auto' or 'Property'. When you set this property to 'Auto', the number of detection indices reported is the total number of cells under test that have detections. If you set this property to 'Property', the number of reported detections is determined by the value of the NumDetections property.

Dependencies

To enable this property, set the OutputFormat property to 'Detection index'.

Data Types: char

Maximum number of detection indices to report, specified as a positive integer.

Dependencies

To enable this property, set the OutputFormat property to 'Detection index' and the NumDetectionsSource property to 'Property'.

Data Types: double

Usage

Description

Y = detector(X,cutidx) performs CFAR detection on input image data, X, for the image cells under test (CUT) specified by cutidx. Y contains the detection results for the CUT cells.

[Y,th] = detector(___) 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] = detector(___) 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 = detector(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] = detector(X,cutidx,thfac).

Input Arguments

expand all

CFAR detector, specified as a phased.CFARDetector System object.

Input image, specified as a real M-by-1 column vector or a real M-by-N-matrix. M and N represent the rows and columns of a matrix.

Data Types: single | double

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.

Data Types: single | double

Threshold factor used to calculate the detection threshold, specified as a positive scalar.

Dependencies

To enable this input argument, set the ThresholdFactor property of the detector object to 'Input port'

Data Types: single | double

Output Arguments

expand all

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.

Data Types: single | double

Computed detection threshold for each detected cell, returned as a real-valued matrix. th has the same dimensions as Y.

  • When OutputFormat is 'CUT result', th returns the detection threshold whenever an element of Y is 1 and NaN whenever an element of Y is 0.

  • 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.

Dependencies

To enable this output argument, set the ThresholdOutputPort to true.

Data Types: single | double

Estimated noise power for each detected cell, returned as a real-valued matrix. noise has the same dimensions as Y.

  • When OutputFormat is 'CUT result', noise returns the noise power whenever an element of Y is 1 and NaN whenever an element of Y is 0.

  • When OutputFormat is 'Detection index', noise returns a noise power 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.

Dependencies

To enable this output argument, set the NoisePowerOutputPort to true.

Data Types: single | double

Object Functions

To use an object function, specify the System object as the first input argument. For example, to release system resources of a System object named obj, use this syntax:

release(obj)

expand all

stepRun System object algorithm
releaseRelease resources and allow changes to System object property values and input characteristics
resetReset internal states of System object

Examples

collapse 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

expand all

References

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

Extended Capabilities

Version History

Introduced in R2011a