保留过滤器状态以处理块中的数据

信息处理 matlab 过滤器
2022-02-18 05:40:42

我有 1 分钟的数据块,但我想对这些数据进行过滤,就好像数据是一个连续的信号一样。我如何在处理数据块之间保持过滤器状态以实现此目的。

我在 MATLAB 中使用 FIR 和该filter()函数。

2个回答

您可以使用带有初始条件的matlab的过滤函数,语法如下:(摘自Matlab 6.0命令窗口帮助)

[Y,Zf] = FILTER(B,A,X,Zi) gives access to initial and final conditions, Zi
and Zf, of the delays.  Zi is a vector of length MAX(LENGTH(A),LENGTH(B))-1
or an array of such vectors, one for each column of X.

希望这可以帮助。

过滤器函数具有zi初始过滤器状态的参数。它还返回zf, 作为最终的过滤器状态。因此,您可以执行以下操作:

% Assuming chunks contains the chunks as the columns:
zi = 0;
for c = 1:size(chunks,2)
  [y, zi] = filter(..., zi);
end

然后,在调用之间保留过滤器状态。但是,您需要注意您需要执行重叠并添加返回的序列 y。