This is an archival dump of old wiki content --- see scipy.org for current material.
Please see http://scipy-cookbook.readthedocs.org/

This page demonstrates two functions in scipy.signal for generating frequency-swept signals: chirp and sweep_poly.

Some of these require SciPy 0.8.

To run the code samples, you will need the following imports:

    import numpy as np
    from scipy.signal import chirp, sweep_poly

Linear Chirp

Sample code:

    t = np.linspace(0, 10, 5001)
    w = chirp(t, f0=12.5, f1=2.5, t1=10, method='linear')

chirp_linear.png

Quadratic Chirp

Sample code:

    t = np.linspace(0, 10, 5001)
    w = chirp(t, f0=12.5, f1=2.5, t1=10, method='quadratic')

chirp_quadratic.png

Sample code using vertex_zero:

    t = np.linspace(0, 10, 5001)
    w = chirp(t, f0=12.5, f1=2.5, t1=10, method='quadratic', vertex_zero=False)

chirp_quadratic_v0false.png

Logarithmic Chirp

Sample code:

    t = np.linspace(0, 10, 5001)
    w = chirp(t, f0=12.5, f1=2.5, t1=10, method='logarithmic')

chirp_logarithmic.png

Hyperbolic Chirp

Sample code:

    t = np.linspace(0, 10, 5001)
    w = chirp(t, f0=12.5, f1=2.5, t1=10, method='hyperbolic')

chirp_hyperbolic.png

Sweep Poly

Sample code:

    p = poly1d([0.05, -0.75, 2.5, 5.0])
    t = np.linspace(0, 10, 5001)
    w = sweep_poly(t, p)

sweep_poly.png

The script that generated the plots is here:

chirp_plot.py

SciPy: Cookbook/FrequencySweptDemo (last edited 2015-10-24 17:48:23 by anonymous)