通过阅读以前的问题和谷歌搜索,整个早上都在打破我的大脑......
我从维基百科上的方程式制作了一个 RRC 过滤器。它工作正常,我将它与 python 中的 commpy 库进行了比较。
但我不明白的是频率幅度。
- RRC 滤波器是否应该具有归一化增益,即通过将脉冲响应除以总和(脉冲响应)得到 0 dB?
 - 或者我应该将 FFT 结果除以 fftsize 吗?
 - 还是我实际上应该不做这两个?
 
我浏览互联网,许多图像都有很多不同的增益,我无法重现...但我可以重现脉冲和一般频率形状。频率响应只是没有正确垂直移动(以 dB 为单位)以显示与其他图像相同的增益。我错过了什么:(
#Define all parameters needed for RRC
alpha = 0.35 
Fs = Fs
span = 10
sps = 10
num_taps = span*sps
Rs = Fs / sps
#taps must be odd for impulse to be symmetrical on time zero
if not num_taps % 2: num_taps += 1
#time vector
t = np.arange(-((num_taps-1)/2) , (((num_taps-1)/2)+1) , 1) * (1/Fs)
#Root Raised Cosine and deal with special cases
h = np.zeros(len(t))
for element in enumerate(t):
    i,x = element #i holds array index, x holds value of t
    if x == 0: 
        h[i] =  (1 - alpha + (4 * alpha / np.pi))
    elif (alpha != 0 and x == (1 / Rs) / (4 * alpha)) or (alpha != 0 and x == -(1 / Rs) / (4 * alpha)) :
        h[i] = alpha / np.sqrt(2) * ( ((1 + 2 / np.pi) * np.sin(np.pi / (4 * alpha))) + ((1 - 2 / np.pi) * np.cos(np.pi / (4 * alpha))))
    else: #not special cases
        h[i] = (np.sin(np.pi * x * Rs * (1 - alpha) ) + \
                4 * alpha * x * Rs  * np.cos(np.pi * x * Rs * (1 + alpha))) / \
                (np.pi * x * Rs * (1 - (4 * alpha * x *Rs) ** 2 ))
h = h # / np.sum(h) #Should I divide to normalise gain?
#Fourier Transform
fftsize = 4096
f = np.linspace(-Fs / 2, Fs / 2, fftsize) 
H = np.fft.fft(h,fftsize)  #Should I divide by fftsize here?!
H = 10*np.log10( np.abs(H)**2)
H = np.fft.fftshift(H)
#Make the plots
fig = plt.figure()
ax = fig.add_subplot(211)
ax.title.set_text('Raised Cosine Impulse Response')
ax.plot(t,h)
ax.grid(True)
ax = fig.add_subplot(212)
ax.title.set_text('Raised Cosine Frequency Response')
ax.plot(f,H)
ax.grid(True)

