MATLAB过滤器中的混乱滚动

时间:2017-07-30 09:15:26

标签: matlab signal-processing

我在matlab中有以下代码:

L = 10000;
Power = -100;
A = 10^0.5;
Fs = 25e6;
fc1 = 100;
fc2 = 1e3;
fc3 = 10e3;
fc4 = 100e3;
fc5 = 1e6;
a1 = 2*pi*fc1/Fs;
a2 = 2*pi*fc2/Fs;
a3 = 2*pi*fc3/Fs;
a4 = 2*pi*fc4/Fs;
a5 = 2*pi*fc5/Fs;

x = wgn(1,L,Power);
y1 = zeros(1,L);
y2 = zeros(1,L);
y3 = zeros(1,L);
y4 = zeros(1,L);
y5 = zeros(1,L);
y = zeros(1,L);
for i = 2:L,
    y1(i) = (1-a1)*y1(i-1) + a1*x(i);
    y2(i) = (1-a2)*y2(i-1) + a2*x(i)/A;
    y3(i) = (1-a2)*y3(i-1) + a3*x(i)/A^2;
    y4(i) = (1-a2)*y4(i-1) + a4*x(i)/A^3;
    y5(i) = (1-a2)*y5(i-1) + a5*x(i)/A^4;
    y(i) = y1(i) + y2(i) + y3(i) + y4(i) + y5(i);
end
fft1 = fft(y);
fft1 = fft1(1:length(y)/2+1);
psd1 = (1/(Fs*length(y)))*abs(fft1).^2;
psd1(2:end-1) = 2*psd1(2:end-1);
freq = 0:Fs/length(y):Fs/2;
figure(3);
semilogx(freq,10*log10(psd1))
grid on

Ts = 40e-9;
z = tf('z',Ts);
H1 = a1/(1-(1-a1)*z^-1);
H2 = (a2/A)/(1-(1-a2)*z^-1);
H3 = (a3/A^2)/(1-(1-a3)*z^-1);
H4 = (a4/A^3)/(1-(1-a4)*z^-1);
H5 = (a5/A^4)/(1-(1-a5)*z^-1);
H = (H1 + H2 + H3 + H4 + H5);
figure(5);
bode(H),grid

此代码的目的是模拟闪烁噪声,其功率谱密度具有10dB / dec的斜率。
要建模一个滤波器,其输出为y(i),输入x(i),在这种情况下为白色高斯噪声。在滤波器的波特图(标记为图5)中,我可以看到它按照我的预期有10dB / dec的滚降。
但是当我检查输出噪声(在这种情况下是y(i))功率谱密度(标记为图3)时,我看到20dB / dec的滚降。
有人可以解释一下我做错了什么以及为什么我无法获得功率谱密度的10dB滚降?

1 个答案:

答案 0 :(得分:1)

您的波特图使用传递函数,该函数是5个相似子滤波器的总和,每个子滤波器使用系数a i 。在您的实现中,您应该同样具有5个具有常规结构的子过滤器。 Howerver,在复制每一行时,您将y3y4y5的一些系数保留为使用a2。您应该通过简单地替换相应的a3a4a5来获得预期结果:

for i = 2:L,
    y1(i) = (1-a1)*y1(i-1) + a1*x(i);
    y2(i) = (1-a2)*y2(i-1) + a2*x(i)/A;
    y3(i) = (1-a3)*y3(i-1) + a3*x(i)/A^2;
    y4(i) = (1-a4)*y4(i-1) + a4*x(i)/A^3;
    y5(i) = (1-a5)*y5(i-1) + a5*x(i)/A^4;
    y(i) = y1(i) + y2(i) + y3(i) + y4(i) + y5(i);
end