This site contains two basic MATLAB programs for plotting ambiguity functions.
The more basic program ambfn1.m prompts for the signal (a complex row vector),
for frequency coding if it exists, and for various parameters that define the
desired ambiguity function plot. The program produces an additional figure, which
includes three subplots: Amplitude, phase and frequency of the signal.
The more elaborate program ambfn7.m creates a graphic user interface (GUI).
The GUI allows choosing one of many preset signals, or defining a new signal
through its amplitude, phase and frequency vectors.
The GUI's four push buttons, call one or more of the following programs:
These four additional m-files calculate and plot, respectively:
(1) the ambiguity function,
(2) the signal,
(3) its autocorrelation function, periodic autocorrelation, and frequency spectrum and
(4) the periodic ambiguity function.
The four additional m-files must be stored in the same directory as ambfn7.m.
HINTS ON USING AMBFN7.M:
The signal is defined by the vectors in the three slots in the GUI: Amplitude, Phase/pi and frequency*tb.
When you choose a preset signal the slots are filled automatically.
You can define a signal externally (in the MATLAB Command window) by entering three vectors respectively: u_amp, u_phase and f_basic. (They must all be row vectors of the same length.)
The u_amp vector must be defined. One or two of the other vectors can be avoided, but then you need to toggle off the dot next to the corresponding slot in the GUI (by clicking on it).
There are 5 parameters in the GUI: r F*Mtb T N K
Of those, the only parameter that affects the signal and not only the plots is "r". Since the signal is defined by a vector, with a well defined length (number of elements , referred to as M), it is often necessary to increase the number of samples (repeats) during each of these elements ("bits"), in order to meet the Nyquist criterion. This is the function of r .
Suggested values for r:
In a Costas signal of M elements the signal bandwidth is approximately M/tb. Therefore, the sampling interval should be
ts < tb/(2M)
tb/ts = r > 2M
In a phase-coded signal, the main spectral lobe ends at f = 1/tb. However, the spectral sidelobes extend much further at a rate of approximately 6 dB per octave. A typical spectral skirt crosses the -30 dB level at f = 10/tb. Hence, choosing r = 2 is the minimum setting, but using r > 10 is recommended.
Any time you change r you need to click on the "Cal&Plot Sig." button to recalculate the signal. Only then you can click on any of the other buttons to get the different plots.
When you change any of the other GUI parameters (F*Mtb T N K ), you can usually click on the different plot buttons without recalculating the signal.
The GUI parameters (F*Mtb T N K ), are associated only with the plots.
F*Mtb - defines the extent of the plotted Doppler axis in normalized Doppler (Doppler multiplied by the entire duration of the signal (Mtb)).
F*Mtb also defines the extent of the frequency axis in the spectrum plot (the lower subplot created when you click on the "ACF. & SPEC Plot."). While the maximum value in the F*Mtb ruler is 60, you can type in a higher value .
T - is the extent of the (positive) delay axis in units of the entire duration of the signal, so it is actually T/Mtb.
For example, if you choose the signal "pulse train, 6 pulses" and choose T=1, the ambiguity plot will include all the 5 recurrent lobes. If you choose T=1/6 you will get exactly one repetition period.
N - is the number of grid points on the (positive) delay axis of the plot.
K - is the number of grid points on the Doppler axis of the plot.
Regarding the periodic ambiguity function (PAF):
If you want to choose one of the preset signals, but wish to plot the PAF when the processor is matched to several periods of the signal (e.g., 4 periods), then you can do the following:
In the GUI choose the desired signal and click on the "Cal&Plot Sig." button.
Next, in the MATLAB command window enter three commands as follows:
u_amp=[u_amp u_amp u_amp u_amp];
u_phase=[u_phase u_phase u_phase u_phase];
f_basic=[f_basic f_basic f_basic f_basic];
Next click again on the "Cal&Plot Sig." button.
In this way you have modified the signal to 4 repeats of the original signal. If you now plot the periodic ambiguity function, you will see the difference. (The volume is concentrated near Doppler values of n/period.)
If you wish to display exactly 2 periods of the PAF, you can change T from 1 to T=0.25 .