[Python] Why is the numerator coefficient array returned by scipy.signal.cont2discrete two...

Discussão em 'Python' iniciado por Stack, Abril 29, 2025.

  1. Stack

    Stack Membro Participativo

    I'm converting a continuous-time dynamical system to discrete time using the function cont2discrete from Scipy's signal processing library.

    dt = 0.1
    num, den, dt = scipy.signal.cont2discrete(([1], [5, 1]), dt)
    print(num, den)


    Output:

    [[0. 0.01980133]] [ 1. -0.98019867]


    I then want to simulate this using lfilter, but lfilter takes a, b as arguments which are the numerator/denominator coefficient vectors "in a 1-D sequence."

    So I need to do this:

    u = np.ones(50)
    y = scipy.signal.lfilter(num[0], den, u)


    I'm just wondering why the convention is different for num and den, and for these two functions.

    Continue reading...

Compartilhe esta Página