<jupyter_start><jupyter_text>Lecture 1 - September 27, 2021  Synthetic Aperture Radar (SAR)  Part 1: Range Resolution<jupyter_code># --- To get started, we set the ipympl backend, which makes matplotlib plots interactive.
# --- We do this using a magic command, starting with %.
%matplotlib widget

# --- import libraries
import sys
sys.path.append('/projects/src/')

import numpy as np
import matplotlib.pyplot as plt
from numpy.fft import fft, fftfreq, fftshift, ifft

# --- import rat class
from ste_io import *

# --- Useful functions

def rect(t, T0):
    # Implements y = rect(t/T0) = 1 if abs(t/T0) <= 0.5, 0 otherwise 
    # All input / outputs are Numpy arrays
    
    N = t.shape[0]
    y = np.zeros(N, 'float32') 
    y[np.abs(t/T0) <= 0.5] = 1
    
    return y

# --- Constants

# speed of light
c0 = 2.9972190e+08<jupyter_output><empty_output><jupyter_text>Exercise 1The typical P-band chirp transmitted by the F-SAR system is characterized by the following input parameters:<jupyter_code># --- Input parameters

# chirp duration, s
T = 1.0016000e-05
# chirp bandwidth, Hz
Wr = 50.0e6<jupyter_output><empty_output><jupyter_text>In the focusing process, the following parameters are chosen for ther ange axis:<jupyter_code># number of samples in range
Ns = 3772
# range sampling, m
rs = 1.1988876<jupyter_output><empty_output><jupyter_text>1. Calculate and plot the chirp signal;2. Generate the impulse responde of the matched filter;3. Calculate and plot the output (convolution) of the matched filter with the chirp as input.   Solution<jupyter_code># create time axis
range_axis = np.linspace(0, Ns-1, Ns) * rs
range_axis = range_axis - np.max(range_axis)/2
# from range to time
time = range_axis * 2/c0

# generation of chirp
kr = Wr / T
s0_t = np.exp(1j * np.pi * kr * time**2) * rect(time, T)

# plot chirp
plt.figure()
plt.plot(time, np.real(s0_t))
plt.xlabel('Time (s)')
plt.ylabel('Real part')
plt.title('Chirp')
plt.grid()

# generation of matched filter
h0_t = np.conj(s0_t[::-1])

# calculate the output
u0_t = np.convolve(s0_t, h0_t, 'same')

# plot chirp
plt.figure()
plt.plot(time, np.real(u0_t))
plt.xlabel('Time (s)')
plt.ylabel('Real part')
plt.title('Output of matched filter')
plt.grid()<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.123500666370502, 'fraction_numerical': 0.03509551310528654, 'mean_word_length': 4.1770114942528735, 'pattern_counts': {'":': 0, '<': 19, '<?xml version=': 0, '>': 17, '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': '4', 'dir': 'jupyter-structured-clean-dedup', 'id': '489207', 'license': 'MIT', 'n_tokens_mistral': 897, 'n_tokens_neox': 830, 'n_words': 250, 'path': 'notebooks-us-solution/2021_09_27_Lecture1_SAR_Part1_Mon.ipynb', 'repo_name': 'IslamAlam/sar-introduction', 'size': '2251'}