[Python] How to use scipy signal for MIMO systems for onestep

Discussão em 'Python' iniciado por Stack, Setembro 27, 2024.

  1. Stack

    Stack Membro Participativo

    code:

    import numpy as np
    from harold import Transfer, simulate_linear_system
    import matplotlib.pyplot as plt
    from scipy import signal

    nbr_inputs = 5
    t_in = np.arange(0, 10, 0.2)
    dim = (nbr_inputs, len(t_in))

    x = np.cumsum(np.random.normal(0, 2e-3, dim), axis=1)

    H = Transfer([[[1, 1, 1], [1, 1, 2], [1, 1, 3], [1, 1, 4], [1, 1, 5]]], [[[1, 1, 1], [1, 1, 2], [1, 1, 3], [1, 1, 4], [1, 1, 5]]])

    y, t = simulate_linear_system(H, x.T, t_in[0:1], per_channel=True)

    y = y.squeeze()

    plt.plot(t, y)
    plt.xlabel('Time')
    plt.ylabel('Output')
    plt.title('System Output Response')
    plt.legend(['Input 1', 'Input 2', 'Input 3', 'Input 4', 'Input 5'])
    plt.show()


    I want to use simulate_linear_system for onestep like: for i in range(x.shape[1]): 'y[:, i], _ = simulate_linear_system(H, x.T, t_in, per_channel=True)' but error:Time array needs to be a 1D array.

    I want to single step multiple signal input

    Continue reading...

Compartilhe esta Página