[Python] How to plot a sawtooth chirp waveform using an array of frequency and time for an...

Discussão em 'Python' iniciado por Stack, Maio 28, 2025.

  1. Stack

    Stack Membro Participativo

    Before switching to use sawtooth I was using sine wave but in sine wave high frequency content was not clearly visible, But I don't have any experience with using sawtooth waveforms. I am going to make a custom block from this code in GNU Radio so I won't be able to use scipy.signal.sawtooth or signal.chirp. as some libraries don't work in GNU radio.

    import numpy as np
    import matplotlib.pyplot as plt
    from math import pi

    chirp_duration = 60e-6
    f0 = 1e6
    f1 = 3e6
    no_samp = 1001
    rcs = 0.0377

    f_step = (f1-f0)/no_samp
    rf_axis = np.linspace(f0, f1, int(f_step))
    rt_axis = np.linspace(0, chirp_duration, int(f_step))

    # rchirp = np.cos(2 * np.pi * rf_axis * rt_axis)

    plt.figure(figsize=(12, 3))
    plt.xlabel("Time")
    plt.ylabel("Frequency")
    plt.title('Received Chirp')
    plt.plot(rt_axis, rf_axis)
    plt.show()


    This is the code I was using to generate the chirp signal in sine wave. This code works perfectly for low frequency values of f0 and f1.

    Continue reading...

Compartilhe esta Página