FIR 滤波器长度是否包含作为系数的截距?-- Matlab

FIR filter length is the intercept included as a coefficient?-- Matlab

我对 FIR 系统的术语和模拟有些困惑。我将感谢帮助纠正我的错误并告知正确的内容。

假设 FIR 滤波器具有系数数组 A=[1,c2,c3,c4]。元素数量为 L,因此过滤器的长度为 L,但顺序为 L-1

Confusion1:截距1算不算系数?它总是1吗?

Confusion2: 对于给定的示例,长度 L= 4order=3 我的理解是否正确?

Confusion3: 在数学上,我可以这样写:

其中 u 是输入数据,l 从零开始。然后为了模拟上面的等式,我做了以下卷积。正确吗?:

N =100; %number of data
A = [1, 0.1, -0.5, 0.62];
u = rand(1,N);
x(1) = 0.0;
x(2) = 0.0;
x(3) = 0.0;
x(4) = 0.0;
for n = 5:N
    x(n) = A(1)*u(n) + A(2)*u(n-1)+ A(3)*u(n-3)+ A(4)*u(n-4);
end

Confusion1: Is the intercept 1 considered as a coefficient? Is it always 1?

是的,它被认为是一个系数,不,它并不总是 1。通过将所有系数相乘(即缩放滤波器的输入或输出),在系数数组中包含一个全局缩放因子是很常见的系数 [1,c1,c2,c2] by K 等同于使用系数 [K,K*c1,K*c2,K*c3] 的滤波器)。另请注意,许多 FIR 滤波器设计技术生成的系数的振幅峰值靠近系数阵列的中间,并在开始和结束时逐渐减小。

Confusion2: Is my understanding correct that for the given example the length L= 4 and order = 3?

是的,没错

Confusion3: [...] Then to simulate the above equation I have done the following convolution. Is it correct? [...]

差不多,但不完全是。以下是您需要修复的几件事。

  1. 在主 for 循环中,应用公式,你会增加 A 的索引,并为每个术语将 u 的索引减少 1,所以你实际上会得到x(n) = A(1)*u(n) + A(2)*u(n-1)+ A(3)*u(n-2)+ A(4)*u(n-3)
  2. 你实际上可以在 n=4
  3. 开始这个循环
  4. 前几个输出仍应使用公式,但删除 u(n-k)n-k 将小于 1。因此,对于 x(3) 你会放弃 1 个学期,对于 x(2),您将放弃 2 个学期,对于 x(1),您将放弃 3 个学期。

修改后的代码如下所示:

x(1)=A(1)*u(1);
x(2)=A(1)*u(2) + A(2)*u(1);
x(3)=A(1)*u(3) + A(2)*u(2) + A(3)*u(1);
for n = 4:N
  x(n) = A(1)*u(n) + A(2)*u(n-1)+ A(3)*u(n-2)+ A(4)*u(n-3);
end