Est. read time: 1 minute | Last updated: July 17, 2024 by John Gentile


Open In Colab

import numpy as np
import matplotlib.pyplot as plt

from rfproto import measurements, plot, sig_gen


A chirp is a signal where the frequency increases (up-chirp) or decreases (down-chirp) with time, (also known as a frequency sweep).

Linear Frequency Modulated (LFM) Chirp

In LFM chirp, the instantaneous frequency, f(t)f(t) (in Hz), varies linearly with time:

f(t)=ct+f0f(t) = ct + f_{0}

where f0f_{0} is the starting frequency (Hz), and cc is the constant chirp rate given an end frequency f1f_{1} (Hz) and the sweep time between frequencies TT:

c=f1f0Tc = \frac{f_{1} - f_{0}}{T}

Since frequency is the derivative of phase (e.g. ω(t)=dϕ(t)dt\omega(t) = \frac{d\phi(t)}{dt}), and frequency is linearly changing (increasing or decreasing), it is expected that phase changes quadratic over time, as shown by:

ϕ(t)=ϕ0+2π0tf(τ)dτϕ0+2π0t(cτ+f0)dτ\phi(t) = \phi_{0} + 2\pi \int^{t}_{0}f(\tau)d\tau \rightarrow \phi_{0} + 2\pi \int^{t}_{0}(c\tau + f_{0})d\tau ϕ(t)=ϕ0+2π(c2t2+f0t)\therefore \phi(t) = \phi_{0} + 2\pi \left( \frac{c}{2}t^{2} + f_{0}t \right)

The corresponding time-domain output is simply the sin()\sin() of this phase function, or ejϕ(t)e^{j\phi(t)} for complex output.

f_start = 10e3
f_end = 40e3
fs = 100e3
num_samples = 10000

lfm_chirp_sig = sig_gen.cmplx_dt_lfm_chirp(1, f_start, f_end, fs, num_samples)
freq, y_PSD = measurements.PSD(lfm_chirp_sig, fs, real=False, norm=True)
plot.freq_sig(freq, y_PSD, "LFM Chirp Spectrum", scale_noise=True)