为什么invres和invresz给我相同的结果,但freqs和freqz给出了完全不同的结果?

时间:2017-05-24 21:52:35

标签: python scipy filtering signal-processing

我使用 scipy.signal.invresz ()从极点/残差规格生成数字滤波器。我注意到使用 invres ()函数给出了相同的结果。但是,使用 freqz freqs 生成绘图数据会给出截然不同的图;为什么呢?

%matplotlib inline

import random
import numpy        as np
import scipy.signal as sig

from matplotlib import pyplot as plt

# Simulation configuration
n_bits        = 128
samps_per_bit = 32
symbols       = [1, -1]
peaking_mag   = 12         # (dB)

# Generate the oversampled random symbol stream.
u = np.array([random.choice(symbols) for i in xrange(n_bits)]).repeat(samps_per_bit)

# Generate the peaking filter (i.e. - CTLE).
p1 = -1. / samps_per_bit
p2 = -2. / samps_per_bit
z  = p1 / pow(10., peaking_mag / 20.)
r1 = (z - p1) / (p2 - p1)
r2 = 1. - r1

# I get the same values for 'b' and 'a', whether I use invres, or invresz.
b, a = sig.invresz([r1, r2], [p1, p2], [])
print b, a
b, a = sig.invres([r1, r2], [p1, p2], [])
print b, a

# But, I get drastically different plots, depending upon my use of freqz vs. freqs.
# I was expecting to get similar plots, as long as I was consistent in my choice of S vs. Z domain.
# That is: use invresz/freqz, or invres/freqs.
w, h = sig.freqz(b, a)
plt.plot(w, abs(h))
plt.figure()
w, h = sig.freqs(b, a)
plt.plot(w, abs(h))

[1. 0.00784965] [1. 0.09375 0.00195312]
[1. 0.00784965] [1. 0.09375 0.00195312]

缺货[16]: Showing plot difference, freqz vs. frees.

0 个答案:

没有答案