Python control.Python lsim

Asked

Viewed 76 times

0

I’m trying to get the system response by inserting a sinusoidal input function, but the code below gives the following error:

Valueerror: Parameter T: time values must be equally Spaced.

from control.matlab import *
import numpy as np
import matplotlib.pyplot as plt
# o caso em tempo continuo
# o sistema com resposta ao impulso h(t)=exp(-t)u(t) sera definido como
num = [1]
den = [1,1]
sys = tf(num,den)

#entrada senoidal
t = np.arange(0,20,0.01)
w0 = 3
u = np.cos(w0*t)
y,t,x = lsim(sys, t, u)

plt.plot(t,y)
plt.grid()
plt.show()
No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.