Main Content

ambgfun

Ambiguity and crossambiguity function

Description

afmag = ambgfun(x,Fs,PRF) returns the magnitude of the normalized ambiguity function for the vector x. Fs is the sampling frequency. PRF is the pulse repetition frequency.

example

[afmag,delay,doppler] = ambgfun(___) or [afmag,delay,doppler] = ambgfun(___,Cut="2D") returns the time delay vector, delay, and the Doppler frequency vector, doppler.

example

afmag = ambgfun(x,y,Fs,PRF) returns the magnitude of the normalized crossambiguity function between pulse x and pulse y. This syntax is equivalent to [afmag,delay,doppler] = ambgfun(___,Cut="2D")

[afmag,delay] = ambgfun(___,Cut="Doppler") returns delays from a zero-Doppler cut through the 2-D normalized ambiguity function magnitude.

example

[afmag,delay] = ambgfun(___,Cut="Doppler",CutValue=V) returns delays from a nonzero Doppler cut through the 2-D normalized ambiguity function magnitude at Doppler values V.

example

[afmag,doppler] = ambgfun(___,Cut="Delay") returns the Doppler values from zero-delay cut through the 2-D normalized ambiguity function magnitude.

[afmag,doppler] = ambgfun(___,Cut="Delay",CutValue=V) returns the Doppler values from a one-dimensional cut through the 2-D normalized ambiguity function magnitude at a delay values V.

ambgfun(___), with no output arguments, plots the ambiguity or crossambiguity function. When is Cut="2D", the function produces a contour plot of the ambiguity function. When Cut="Delay" or Cut="Doppler", the function produces a line plot of the ambiguity function.

example

Examples

collapse all

Plot the ambiguity function magnitude of a rectangular pulse.

waveform = phased.RectangularWaveform;
x = waveform();
PRF = waveform.PRF;
[afmag,delay,doppler] = ambgfun(x,waveform.SampleRate,PRF);
contour(delay,doppler,afmag)
xlabel("Delay (seconds)")
ylabel("Doppler Shift (hertz)")

Figure contains an axes object. The axes object with xlabel Delay (seconds), ylabel Doppler Shift (hertz) contains an object of type contour.

Use the ambgfun function with no output arguments to recreate the plot.

ambgfun(x,waveform.SampleRate,PRF)

Figure contains an axes object. The axes object with title Ambiguity Function, xlabel Delay tau blank (µs), ylabel Doppler f indexOf d baseline blank (kHz) contains an object of type contour.

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 = hrect();
xfm = hfm();
[ambrect,delayrect] = ambgfun(xrect,hrect.SampleRate,...,
    hrect.PRF,"Cut","Doppler");
[ambfm,delayfm] = ambgfun(xfm,hfm.SampleRate,...,
    hfm.PRF,"Cut","Doppler");

subplot(2,1,1)
stem(delayrect,ambrect)
title("Autocorrelation of Rectangular Pulse")
subplot(2,1,2)
stem(delayfm,ambfm)
xlabel("Delay (seconds)")
title("Autocorrelation of Linear FM Pulse")

Figure contains 2 axes objects. Axes object 1 with title Autocorrelation of Rectangular Pulse contains an object of type stem. Axes object 2 with title Autocorrelation of Linear FM Pulse, xlabel Delay (seconds) contains an object of type stem.

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 = hrect();
xfm = 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(2,1,1)
stem(delayrect*10^6,ambrect)
title("Autocorrelation of Rectangular Pulse at 5 kHz Doppler Shift")
subplot(2,1,2)
stem(delayfm*10^6,ambfm)
xlabel("Delay (\mu sec)")
title("Autocorrelation of Linear FM Pulse at 5 kHz Doppler Shift")

Figure contains 2 axes objects. Axes object 1 with title Autocorrelation of Rectangular Pulse at 5 kHz Doppler Shift contains an object of type stem. Axes object 2 with title Autocorrelation of Linear FM Pulse at 5 kHz Doppler Shift, xlabel Delay (\mu sec) contains an object of type stem.

Plot the crossambiguity function between an LFM pulse and a delayed replica. Compare the crossambiguity function with the original ambiguity function. Set the sampling rate to 100 Hz, the pulse width to 0.5 sec, and the pulse repetition frequency to 1 Hz. The delay or lag is 10 samples equal to 100 ms. The bandwidth of the LFM signal is 10 Hz.

fs = 100.0;
bw1 = 10.0;
prf = 1;
nsamp = fs/prf;
pw = 0.5;
nlag = 10;

Create the original waveform and its delayed replica.

waveform1 = phased.LinearFMWaveform("SampleRate",fs,"PulseWidth",1,...
    "SweepBandwidth",bw1,"SweepDirection","Up","PulseWidth",pw,"PRF",prf);
wav1 = waveform1();
wav2 = [zeros(nlag,1);wav1(1:(end-nlag))];

Plot the ambiguity and crossambiguity functions.

ambgfun(wav1,fs,prf,"Cut","Doppler","CutValue",5)
hold on
ambgfun(wav1,wav2,fs,[prf,prf],"Cut","Doppler","CutValue",5)
hold off
legend("Signal ambiguity","Crossambiguity")

Figure contains an axes object. The axes object with title Crossambiguity Function, 5 Hz Doppler Cut, xlabel Delay tau blank (ms), ylabel Crossambiguity Function contains 2 objects of type line. These objects represent Signal ambiguity, Crossambiguity.

Input Arguments

collapse all

Input pulse waveform, specified as a complex-valued row or column vector.

Example: wf = phased.LinearFMWaveform; wf()

Data Types: dounle | single

Second input pulse waveform, specified as a complex-valued row or column vector.

Example: wf = phased.RectangularWaveform; wf()

Data Types: dounle | single

Sample frequency, specified as a positive scalar. Units are in Hz.

Example: wf = phased.LinearFMWaveform; wf.SampleRate

Data Types: dounle | single

Pulse repetition frequency, specified as a positive scalar. Units are in Hz.

Example: wf = phased.LinearFMWaveform; wf.PRF

Data Types: dounle | single

Name-Value Arguments

collapse all

Specify optional pairs of arguments as Name1=Value1,...,NameN=ValueN, where Name is the argument name and Value is the corresponding value. Name-value arguments must appear after other arguments, but the order of the pairs does not matter.

Before R2021a, use commas to separate each name and value, and enclose Name in quotes.

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

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

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. You can create a cut at nonzero time delay using the name-value pair "CutValue".

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. You can create cut at nonzero Doppler using the name-value pair "CutValue".

Data Types: char | string

Cut values, specified as a real-valued scalar or length-K real-valued vector. When setting the name-value pair "Cut" to "Delay" or "Doppler", you can set "CutValue" to specify cross-sections that may not coincide with either zero time delay or zero Doppler shift. However, "CutValue" cannot be used when "Cut" is set to "2D".

  • When "Cut" is set to "Delay", "CutValue" is the time delay at which the cut is taken. If '"Cut" is "Delay", the entries in V should be between -T and T where T is the duration of the waveform X in seconds. In this case the output afmag is an M-by-K matrix, where M is the number of Doppler shifts. Time delay units are in seconds.

  • When "Cut" is set to "Doppler", "CutValue" is the Doppler shift at which the cut is taken. If "Cut" is '"Doppler'", the entries in V should be between -Fs/2 and Fs/2, where Fs is the sampling frequency in Hz. In this case the output afmag is a K-by-N matrix, where N is the number of time delays. Doppler units are in Hz.

Example: CutValue=10.0

Dependencies

To enable this Name-Value argument, set the value of the Name-Value argument Vto "Delay" or "Doppler".

Data Types: double

Output Arguments

collapse all

Normalized ambiguity or crossambiguity function magnitudes, returned as a matrix. afmag is an M-by-N matrix where M is the number of Doppler frequencies and N is the number of time delays.

Time delays, returned as a vector. delay is an N-by-1 vector of time delays.

For the ambiguity function, if Nx is the length of signal x, then the delay vector consist of N = 2Nx – 1 samples in the range, –(Nx/2) – 1,...,(Nx/2) – 1).

For the crossambiguity function, let Ny be the length of the second signal. The time delay vector consists of N = Nx+ Ny– 1 equally spaced samples. For an even number of delays, the delay sample times are –(N/2 – 1)/Fs,...,(N/2 – 1))/Fs. For an odd number of delays, if Nf = floor(N/2), the delay sample times are –Nf /Fs,...,(Nf – 1)/Fs.

Doppler frequencies, returned as a vector. doppler is an M-by-1 vector of Doppler frequencies. The Doppler frequency vector consists of M = 2ceil(log2 N) equally-spaced samples. Frequencies are –Fs/2,...,Fs/2-Fs/M.

More About

collapse all

Extended Capabilities

expand all

GPU Arrays
Accelerate code by running on a graphics processing unit (GPU) using Parallel Computing Toolbox™.

Version History

Introduced in R2011a