<jupyter_start><jupyter_text>***Introduction to Radar Using Python and MATLAB*** <NAME> - Copyright (C) 2019 Artech House Pulse Train Ambiguity Function*** Referring to Section 8.6.1, the amibguity function for a coherent pulse train is found by employing the generic waveform technique outlined in Section 8.6.3.*** Begin by getting the library path<jupyter_code>import lib_path<jupyter_output><empty_output><jupyter_text>Set the pulsewidth (s), the pulse repetition interval (s) and the number of pulses<jupyter_code>pulsewidth = 0.4

pri = 1.0

number_of_pulses = 6<jupyter_output><empty_output><jupyter_text>Generate the time delay (s) using the `linspace` routine from `scipy`<jupyter_code>from numpy import linspace


# Set the time delay

time_delay = linspace(-number_of_pulses * pri, number_of_pulses * pri, 5000)<jupyter_output><empty_output><jupyter_text>Calculate the ambiguity function for the pulse train<jupyter_code>from Libs.ambiguity.ambiguity_function import pulse_train

from numpy import finfo


ambiguity = pulse_train(time_delay, finfo(float).eps, pulsewidth, pri, number_of_pulses)<jupyter_output><empty_output><jupyter_text>Plot the zero-Doppler cut using the `matplotlib` routines<jupyter_code>from matplotlib import pyplot as plt


# Set the figure size

plt.rcParams["figure.figsize"] = (15, 10)



# Plot the ambiguity function

plt.plot(time_delay, ambiguity, '')



# Set the x and y axis labels

plt.xlabel("Time (s)", size=12)

plt.ylabel("Relative Amplitude", size=12)



# Turn on the grid

plt.grid(linestyle=':', linewidth=0.5)



# Set the plot title and labels

plt.title('Pulse Train Ambiguity Function', size=14)



# Set the tick label size

plt.tick_params(labelsize=12)<jupyter_output><empty_output><jupyter_text>Set the Doppler mismatch frequencies using the `linspace` routine<jupyter_code>doppler_frequency = linspace(-2.0 / pulsewidth, 2.0 / pulsewidth, 1000)<jupyter_output><empty_output><jupyter_text>Calculate the ambiguity function for the pulse train<jupyter_code>ambiguity = pulse_train(finfo(float).eps, doppler_frequency, pulsewidth, pri, number_of_pulses)<jupyter_output><empty_output><jupyter_text>Display the zero-range cut for the pulse train<jupyter_code>plt.plot(doppler_frequency, ambiguity, '')


# Set the x and y axis labels

plt.xlabel("Doppler (Hz)", size=12)

plt.ylabel("Relative Amplitude", size=12)



# Turn on the grid

plt.grid(linestyle=':', linewidth=0.5)



# Set the plot title and labels

plt.title('Pulse Train Ambiguity Function', size=14)



# Set the tick label size

plt.tick_params(labelsize=12)<jupyter_output><empty_output><jupyter_text>Set the time delay and Doppler mismatch frequency and create the two-dimensional grid using the `meshgrid` routine from `scipy`<jupyter_code>from numpy import meshgrid


# Set the time delay

time_delay = linspace(-number_of_pulses * pri, number_of_pulses * pri, 1000)



# Set the Doppler mismatch

doppler_frequency = linspace(-2.0 / pulsewidth, 2.0 / pulsewidth, 1000)



# Create the grid

t, f = meshgrid(time_delay, doppler_frequency)<jupyter_output><empty_output><jupyter_text>Calculate the ambiguity function for the pulse train<jupyter_code>ambiguity = pulse_train(t, f, pulsewidth, pri, number_of_pulses)<jupyter_output><empty_output><jupyter_text>Display the two-dimensional contour plot for the pulse train ambiguity function<jupyter_code># Plot the ambiguity function
from numpy import finfo

plt.contour(t, f, ambiguity + finfo('float').eps, 20, cmap='jet', vmin=-0.2, vmax=1.0)


# Set the x and y axis labels

plt.xlabel("Time (s)", size=12)

plt.ylabel("Doppler (Hz)", size=12)



# Turn on the grid

plt.grid(linestyle=':', linewidth=0.5)



# Set the plot title and labels

plt.title('Pulse Pulse Ambiguity Function', size=14)



# Set the tick label size

plt.tick_params(labelsize=12)<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.10103626943005181, 'fraction_numerical': 0.020466321243523315, 'mean_word_length': 6.230337078651686, 'pattern_counts': {'":': 0, '<': 46, '<?xml version=': 0, '>': 46, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '11', 'dir': 'jupyter-structured-clean-dedup', 'id': '1052', 'license': 'Apache-2.0', 'n_tokens_mistral': 1413, 'n_tokens_neox': 1279, 'n_words': 361, 'path': 'jupyter/Chapter08/pulse_train_ambiguity.ipynb', 'repo_name': 'mberkanbicer/software', 'size': '3867'}