Note
Click here to download the full example code
Spectrogram of Parallel Chirps with a Long Gaussian Analysis Window¶
This example visualizes the spectrogram of two “parallel” chirps, using a Gaussian window function that has a long length, relative to the length of a signal. The two chirps can be made out, but interference can also be seen along the time axis, since time resolution is compromised.
Figure 3.16 from the tutorial.
from tftb.generators import fmlin
from tftb.processing.cohen import Spectrogram
import numpy as np
import matplotlib.pyplot as plt
sig = fmlin(128, 0, 0.4)[0] + fmlin(128, 0.1, 0.5)[0]
window = np.exp(np.log(0.005) * np.linspace(-1, 1, 63) ** 2)
spec = Spectrogram(sig, fwindow=window, n_fbins=128)
spec.run()
spec.plot(show_tf=True, cmap=plt.cm.gray)
Total running time of the script: ( 0 minutes 0.488 seconds)