Beispiel #1
0
def calc_psi_and_phi_lists(s1, TF):
    zeros_a = TF.zero()#this returns an array
    zeros = zeros_a.tolist()
    zeros.reverse()#arrays don't have the reverse method that lists do
    poles_a = TF.pole()
    poles = poles_a.tolist()
    poles.reverse()

    psi_list = calc_angle_list(s1, zeros)
    phi_list = calc_angle_list(s1, poles)
    return psi_list, phi_list
Beispiel #2
0
def calc_psi_and_phi_lists(s1, TF):
    zeros_a = TF.zero()  #this returns an array
    zeros = zeros_a.tolist()
    zeros.reverse()  #arrays don't have the reverse method that lists do
    poles_a = TF.pole()
    poles = poles_a.tolist()
    poles.reverse()

    psi_list = calc_angle_list(s1, zeros)
    phi_list = calc_angle_list(s1, poles)
    return psi_list, phi_list
Beispiel #3
0
plt.plot(spectre, 'b')
plt.show()

#3. Max of module
frequency = numpy.argmax(spectre)
print("Task 3 (Maximum of module)\nFrequency: {} [Hz]\n".format(frequency))

#4. Poles and zeros
plt.gcf().clear()
from control import matlab, TransferFunction
from numpy  import real, imag
num = [0.2324, -0.4112, 0.2324]
den = [1, 0.2289, 0.4662]
transfer_function = TransferFunction(num, den)
p = transfer_function.pole()
z = transfer_function.zero()
ax = plt.gca()
patch = plt.Circle((0,0),1,color='b',alpha=0.2)
ax.add_patch(patch)
if len(p) > 0:
    plt.scatter(real(p), imag(p), s=50, marker='x')
if len(z) > 0:
    plt.scatter(real(z), imag(z), s=50, marker='o',
                facecolors='none', edgecolors='g')
plt.axhline(y=0, color='black')
plt.axvline(x=0, color='black')
plt.xlabel('Re')
plt.ylabel('Im')
plt.title("Poles & zeros")
plt.show()
print("Task 4 (IIR filter)")