滤波器过滤一些随机信号

滤波器过滤一些随机信号

本文介绍了在MATLAB中使用自回归(AR)滤波器过滤一些随机信号的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在MATLAB中,如果我有一些信号 x 让我们说

  x = rand(1,1000)

我想要生成通过使用 M 的自回归(AR)过滤器过滤 x ,我如何找到 y(n)?因为自回归滤波器需要过去的输出值来计算,但是我还没有任何过去的输出。我只有输入样本 x

在移动平均(MA)过滤器中,我可以生成 y(n),因为它只需要过去的输入,因为我们有 x ,如下所示:

  for n = 1:1000 
sum = 0; (n-k + 1> 0)
sum = sum +(1 / M)* x(n-k + 1);对于k = 1则为
:M + 1
。 %MA取决于当前&先前的输入
结束
结束
y(n)= sum;
end

任何人都可以帮助我为Autoregressive过滤器生成相同的结果吗?在移动平均过滤器中,你显示你基本上能够通过使用在第一次提供之前的过去的输入样本的假设来计算输出 x(1)中的值为零。同样,对于自回归滤波器,您可以计算输出假设第一个计算值 y(1)之前的过去输出是零:

  for n = 1:1000 

%为ARMA过滤器添加前馈部分
%...对于AR过滤器,这只是sum = x(n)
sum = x(n);

%反馈部分
对于k = 2:M + 1%归一化AR(假设a(1)等于1)
if(n-k + 1> 0)
sum = sum + a(k)* y(n-k + 1);
end
end
y(n)= sum;
end

更一般地说,您也可以通过将过滤器与之前的种子已知的初始条件(尽管在你的特定情况下,你指出那些初始条件是未知的)。

In MATLAB, If I've some signal x let say

x = rand(1,1000)

and I want to generate y by filtering x using Autoregressive (AR) filter of order M. How can I find y(n)? as autoregressive filter needs past values of output for calculation, but I don't have any past output yet. I only have input samples x.

In Moving average (MA) filter I can generate y(n) easily because it only needs past inputs which I can provide easily because we have x, as follows

for n=1:1000
  sum=0;
  for k=1:M+1
    if (n-k+1>0)
      sum = sum + (1/M)*x(n-k+1); % MA depends on current & previous input
    end
  end
  y(n)=sum;
end

Can anyone please help me to generate the same for the Autoregressive filter?

解决方案

In the moving average filter you show you are essentially able to compute the output by using the assumption that past input samples before the first provided value in x(1) were zeros.

Similarly, for an autoregressive filter you may compute the output by making the assumption that past outputs before the first computed value y(1) are zeros:

for n=1:1000

  % Add feedforward section for ARMA filter
  % ... for an AR filter this is just sum=x(n)
  sum = x(n);

  % Feedback section
  for k=2:M+1   % normalized AR (assuming a(1) equals 1)
    if (n-k+1>0)
      sum = sum + a(k)*y(n-k+1);
    end
  end
  y(n) = sum;
end

More generally, you can also compute the output by seeding the filter with some previous known initial-conditions (though in your particular case you indicate that those initial-conditions aren't known).

这篇关于在MATLAB中使用自回归(AR)滤波器过滤一些随机信号的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-21 12:25