Exemplo n.º 1
0
def generate_chirp():
    p = np.poly1d([1.4, 16])
    t = np.linspace(0, 5, 5 * 48)
    w = sweep_poly(t, p)
    w = np.hanning(len(w)) * w

    p = np.poly1d([-1.4, 30])
    t0 = np.linspace(5, 10, 5 * 48)
    t = np.append(t, t0)
    w0 = sweep_poly(t0, p)
    w0 = np.hanning(len(w0)) * w0
    w = np.append(w, w0)

    p = np.poly1d([1.4, 2])
    t0 = np.linspace(10, 15, 5 * 48)
    t = np.append(t, t0)
    w0 = sweep_poly(t0, p)
    w0 = np.hanning(len(w0)) * w0
    w = np.append(w, w0)

    p = np.poly1d([-1.4, 44])
    t0 = np.linspace(15, 20, 5 * 48)
    t = np.append(t, t0)
    w0 = sweep_poly(t0, p)
    w0 = np.hanning(len(w0)) * w0
    w = np.append(w, w0)
    w = w * 0.8

    return w
Exemplo n.º 2
0
def generate_chirp():
    p = np.poly1d([7, 16])
    t = np.linspace(0, 1, 1 * 48)
    w = sweep_poly(t, p)
    w = np.hanning(len(w)) * w
    up_chirp = np.copy(w)
    left_y = np.copy(w)
    right_y = np.zeros(1 * 48)
    p = np.poly1d([-7, 30])
    t0 = np.linspace(1, 2, 1 * 48)
    t = np.append(t, t0)
    w0 = sweep_poly(t0, p)
    w0 = np.hanning(len(w0)) * w0
    w = np.append(w, w0)
    down_chirp = np.copy(w0)
    left_y = np.append(left_y, np.zeros(48))
    right_y = np.append(right_y, w0)
    return left_y, right_y, up_chirp, down_chirp
Exemplo n.º 3
0
def make_sweep_poly(filename=None, fig_size=FIG_SIZE):
    p = poly1d([0.05, -0.75, 2.5, 5.0])

    t = np.linspace(0, t1, 5001)
    w = sweep_poly(t, p)

    figure(1, figsize=fig_size)
    clf()

    subplot(2, 1, 1)
    plot(t, w)
    tstr = "Sweep Poly, $f(t) = 0.05t^3 - 0.75t^2 + 2.5t + 5$"
    title(tstr)

    subplot(2, 1, 2)
    plot(t, p(t), 'r')
    grid(True)
    ylabel('Frequency (Hz)')
    xlabel('time (sec)')
    if filename is None:
        show()
    else:
        savefig(filename)
Exemplo n.º 4
0
def make_sweep_poly(filename=None, fig_size=FIG_SIZE):
    p = poly1d([0.05, -0.75, 2.5, 5.0])

    t = np.linspace(0, t1, 5001)
    w = sweep_poly(t, p)

    figure(1, figsize=fig_size)
    clf()

    subplot(2, 1, 1)
    plot(t, w)
    tstr = "Sweep Poly, $f(t) = 0.05t^3 - 0.75t^2 + 2.5t + 5$"
    title(tstr)

    subplot(2, 1, 2)
    plot(t, p(t), "r")
    grid(True)
    ylabel("Frequency (Hz)")
    xlabel("time (sec)")
    if filename is None:
        show()
    else:
        savefig(filename)