How to do it…

  1. To aid the construction of signals with predetermined properties, the scipy.signal module has a nice collection of the most frequent one-dimensional waveforms in the literature—chirp and sweep_poly (for the frequency-swept cosine generator), gausspulse (a Gaussian modulated sinusoid), and sawtooth and square (for the waveforms with those names).
  2. They all take as their main parameter a one-dimensional ndarray representing the times at which the signal is to be evaluated. Other parameters control the design of the signal according to frequency or time constraints.
  3. Let's take a look into the following code snippet that illustrates the use of these one-dimensional waveforms that we just discussed:
import numpy
from scipy.signal import chirp, sawtooth, square, gausspulse
import matplotlib.pyplot as plt
t=numpy.linspace(-1,1,1000)
plt.subplot(221); plt.ylim([-2,2])
plt.plot(t,chirp(t,f0=100,t1=0.5,f1=200)) # plot a chirp
plt.title("Chirp signal")
plt.subplot(222); plt.ylim([-2,2])
plt.plot(t,gausspulse(t,fc=10,bw=0.5)) # Gauss pulse
plt.title("Gauss pulse")
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset