In [1]:
import numpy as np
import sympy as sy
In [2]:
s = sy.symbols('s', real=False)
In [3]:
np.roots?
In [5]:
poles=np.roots([1, 25.9, 168])
In [6]:
np.abs(poles)
Out[6]:
In [7]:
np.angle(poles)
Out[7]:
In [8]:
poles
Out[8]:
In [9]:
G = 168/(s*(s**2 + 25.9*s + 168))
In [10]:
Y = sy.apart(G/s)
sy.pretty_print(Y)
In [11]:
Y
Out[11]:
In [22]:
a = 12.95
omega = 0.54543561
b1 = 0.15416666667
rest = (2.9929166666667/b1-a)
b2=rest*b1/omega
print b1
print b2
In [23]:
den = s**2 + 25.9*s + 168
sy.together(b1*(s+a)/den + b2*omega/den)
Out[23]:
In [32]:
zeta = 12.95/np.sqrt(0.5454**2 + 12.95**2)
phi = np.arccos(zeta)
np.exp(phi/np.tan(phi))
Out[32]:
In [33]:
print zeta
In [34]:
print phi
In [35]:
2.72/4
Out[35]:
In [38]:
omega0=np.sqrt(0.5454**2 + 12.95**2)
In [39]:
2.72/4/omega0
Out[39]:
In [40]:
2.72/10/omega0
Out[40]:
In [42]:
h=0.025
dreal = np.exp(h*(-12.95))*np.cos(0.5454*h)
dim = np.exp(h*(-12.95))*np.sin(0.5454*h)
print dreal
print dim
dpole = dreal + 1j*dim
In [43]:
print np.abs(dpole)
print np.angle(dpole)
In [ ]: