Accelerating the pace of engineering and science

# Documentation Center

• Trial Software

# ambgfun

Ambiguity function

## Syntax

afmag = ambgfun(x,Fs,PRF)
[afmag,delay,doppler] = ambgfun(x,Fs,PRF)
[afmag,delay,doppler] = ambgfun(x,Fs,PRF,'Cut','2D')
[afmag,delay] = ambgfun(x,Fs,PRF,'Cut','Doppler')
[afmag,doppler] = ambgfun(x,Fs,PRF,'Cut','Delay')
[afmag,delay] = ambgfun(x,Fs,PRF,'Cut','Doppler','CutValue',V)
[afmag,doppler] = ambgfun(x,Fs,PRF,'Cut','Delay','CutValue',V)
ambgfun(x,Fs,PRF)
ambgfun(x,Fs,PRF,'Cut','2D')
ambgfun(x,Fs,PRF,'Cut','Delay')
ambgfun(x,Fs,PRF,'Cut','Doppler')
ambgfun(x,Fs,PRF,'Cut','Delay','CutValue',V)
ambgfun(x,Fs,PRF,'Cut','Doppler','CutValue',V)

## Description

afmag = ambgfun(x,Fs,PRF) returns the magnitude of the normalized ambiguity function for the vector x. The sampling of x occurs at Fs hertz with pulse repetition frequency, PRF. The sampling frequency Fs divided by the pulse repetition frequency PRF is the number of samples per pulse.

[afmag,delay,doppler] = ambgfun(x,Fs,PRF) or [afmag,delay,doppler] = ambgfun(x,Fs,PRF,'Cut','2D') returns the time delay vector, delay, and the Doppler frequency vector, doppler.

[afmag,delay] = ambgfun(x,Fs,PRF,'Cut','Doppler') returns the zero Doppler cut through the 2-D normalized ambiguity function magnitude.

[afmag,doppler] = ambgfun(x,Fs,PRF,'Cut','Delay') returns the zero delay cut through the 2-D normalized ambiguity function magnitude.

[afmag,delay] = ambgfun(x,Fs,PRF,'Cut','Doppler','CutValue',V) returns a one-dimensional cut through the 2-D normalized ambiguity function magnitude at a Doppler value of V Hertz. V should lie in the range[-Fs/2,Fs/2].

[afmag,doppler] = ambgfun(x,Fs,PRF,'Cut','Delay','CutValue',V) returns a one-dimensional cut through the 2-D normalized ambiguity function magnitude at a delay value of V seconds. V should lie in the range [-(length(x)-1)/Fs,(length(x)-1)/Fs].

ambgfun(x,Fs,PRF) or ambgfun(x,Fs,PRF,'Cut','2D') with no output argument produces a contour plot of the ambiguity function.

ambgfun(x,Fs,PRF,'Cut','Delay') or ambgfun(x,Fs,PRF,'Cut','Doppler') with no output argument produces a line plot of the ambiguity function cut.

ambgfun(x,Fs,PRF,'Cut','Delay','CutValue',V) or ambgfun(x,Fs,PRF,'Cut','Doppler','CutValue',V) with no output argument produces a line plot of the ambiguity function cut at non-zero cut values.

## Input Arguments

expand all

 x Pulse waveform. x is a row or column vector. Fs Sampling frequency in hertz. PRF Pulse repetition frequency in hertz.

### Name-Value Pair Arguments

Specify optional comma-separated pairs of Name,Value arguments. Name is the argument name and Value is the corresponding value. Name must appear inside single quotes (' '). You can specify several name and value pair arguments in any order as Name1,Value1,...,NameN,ValueN.

Example: 'Cut','Doppler','CutValue',10 specifies that a vector of ambiguity function values be produced at a Doppler shift of 10 Hz.

### 'Cut' — Direction of one-dimensional cut through ambiguity function'Delay'|'Doppler'|'2D'

Used to generate a one–dimensional cut or cross-section through the ambiguity diagram. The direction of the cut is determined by setting the value of 'Cut' to 'Delay' or 'Doppler'. The value '2D' generates a surface plot of the two-dimensional ambiguity function.

The choice of 'Delay' generates a cut at zero time delay. In this case, the second output argument of ambgfun contains the ambiguity function values at Doppler shifted values. A cut at non-zero time delay can be generated using the name-value pair'CutValue' described below.

The choice of 'Doppler' generates a cut at zero Doppler shift. In this case, the second output argument of ambgfun contains the ambiguity function values at time-delayed values. A cut at non-zero Doppler can be generated using the name-value pair 'CutValue' described below.

### 'CutValue' — Optional time delay or Doppler shift at which ambiguity function cut is takenreal scalar

When setting the name-value pair 'Cut' to 'Delay' or 'Doppler', you can use the name-value pair 'CutValue' to specify a cross-section that does not coincide with either zero time delay or zero Doppler shift. However, 'CutValue' should not be used when 'Cut' is set to '2D'.

When 'Cut' is set to 'Delay' ,'CutValue' is interpreted as the time delay, in seconds, at which the cut is to be taken. The range of possible time delays is determined by the length of the signal and is restricted to [-(length(x)-1)/Fs,(length(x)-1)/Fs].

When 'Cut' is set to 'Doppler', 'CutValue' is interpreted as the Doppler shift, in Hertz, at which the cut is to be taken. The Doppler shift is restricted to the range [-Fs/2,Fs/2].

Example: 'CutValue',10.0

Data Types: double

## Output Arguments

 afmag Normalized ambiguity function magnitudes. afmag is an M-by-N matrix where M is the number of Doppler frequencies and N is the number of time delays. delay Time delay vector. delay is an N-by-1 vector of time delays. The time delay vector consists of N = 2*length(x)-1 linearly spaced samples in the interval (-length(x)/Fs, length(x)/Fs). The spacing between elements is the reciprocal of the sampling frequency. doppler Doppler frequency vector. doppler is an M-by-1 vector of Doppler frequencies. The Doppler frequency vector consists of linearly spaced samples in the frequency interval [-Fs/2,Fs/2). The spacing between elements in the Doppler frequency vector is Fs/2^nextpow2(2*length(x)-1).

## Examples

expand all

### Plot Ambiguity Function of Rectangular Pulse

Plot the ambiguity function magnitude of a rectangular pulse.

hrect = phased.RectangularWaveform;
x = step(hrect);
PRF = 2e4;
[afmag,delay,doppler] = ambgfun(x,hrect.SampleRate,PRF);
contour(delay,doppler,afmag);
xlabel('Delay (seconds)'); ylabel('Doppler Shift (hertz)');


### Plot Autocorrelation Sequences of Rectangular and Linear FM Pulses

This example shows how to plot zero-Doppler cuts of the autocorrelation sequences of rectangular and linear FM pulses of equal duration. Note the pulse compression exhibited in the autocorrelation sequence of the linear FM pulse.

hrect = phased.RectangularWaveform('PRF',2e4);
hfm = phased.LinearFMWaveform('PRF',2e4);
xrect = step(hrect);
xfm = step(hfm);
[ambrect,delayrect] = ambgfun(xrect,hrect.SampleRate,...,
hrect.PRF,'Cut','Doppler');
[ambfm,delayfm] = ambgfun(xfm,hfm.SampleRate,...,
hfm.PRF,'Cut','Doppler');
figure;
subplot(211);
stem(delayrect,ambrect);
title('Autocorrelation of Rectangular Pulse');
subplot(212);
stem(delayfm,ambfm)
xlabel('Delay (seconds)');
title('Autocorrelation of Linear FM Pulse');


### Plot Nonzero-Doppler Cuts of Autocorrelation Sequences

Plot nonzero-Doppler cuts of the autocorrelation sequences of rectangular and linear FM pulses of equal duration. Both cuts are taken at a 5 kHz Doppler shift. Besides the reduction of the peak value, there is a strong shift in the position of the linear FM peak, evidence of range-doppler coupling.

hrect = phased.RectangularWaveform('PRF',2e4);
hfm = phased.LinearFMWaveform('PRF',2e4);
xrect = step(hrect);
xfm = step(hfm);
fd = 5000;
[ambrect,delayrect] = ambgfun(xrect,hrect.SampleRate,...,
hrect.PRF,'Cut','Doppler','CutValue',fd);
[ambfm,delayfm] = ambgfun(xfm,hfm.SampleRate,...,
hfm.PRF,'Cut','Doppler','CutValue',fd);
figure;
subplot(211);
stem(delayrect*10^6,ambrect);
title('Autocorrelation of Rectangular Pulse at 5 kHz Doppler Shift');
subplot(212);
stem(delayfm*10^6,ambfm)
xlabel('Delay (\mu sec)');
title('Autocorrelation of Linear FM Pulse at 5 kHz Doppler Shift');


expand all

### Normalized Ambiguity Function

The magnitude of the normalized ambiguity function is defined as:

where Ex is the norm of the signal, x(t), t is the time delay, and fd is a Doppler shift. The asterisk (*) denotes the complex conjugate.

The ambiguity function is a function of two variables that describes the effects of time delays and Doppler shifts on the output of a matched filter.

The magnitude of the ambiguity function at zero time delay and Doppler shift, indicates the matched filter output when the received waveform exhibits the time delay and Doppler shift for which the matched filter is designed. Nonzero values of the time delay and Doppler shift variables indicate that the received waveform exhibits mismatches in time delay and Doppler shift from the matched filter.

The magnitude of the ambiguity function achieves maximum value at (0,0). At this point, there is perfect correspondence between the received waveform and the matched filter. In the normalized ambiguity function, the maximum value equals one.

## References

[1] Levanon, N. and E. Mozeson. Radar Signals. Hoboken, NJ: John Wiley & Sons, 2004.

[2] Mahafza, B. R., and A. Z. Elsherbeni. MATLAB® Simulations for Radar Systems Design. Boca Raton, FL: CRC Press, 2004.

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