Paso de la función en matplotlib

He visto algunas preguntas sobre las funciones de pasos en matplotlib pero esta es diferente. Aquí está mi función:

def JerkFunction(listOfJerk):
    '''Return the plot of a sequence of jerk'''
    #initialization of the jerk
    x = np.linspace(0,5,4)
    y = listOfJerk #step signal

    plt.axis([0,5,-2,2])
    plt.step(x,y,'y') #step display
    plt.xlabel('Time (s)')
    plt.ylabel('Jerk (m/s^3)')

    plt.title('Jerk produced by the engine')

    return plt.show()

Me gustaría tener la curva obtenida cuando la coloco.JerkFunction([1,1,-1,1]) pero ingresando:[1,-1,1,-1]De hecho, al principio, en un caso real, el valor de sacudida es 0 y ent=0, se vuelvejerk=+1, luego ent=1 esJerk=-1 etc.

Respuestas a la pregunta(2)

Su respuesta a la pregunta