找到你要的答案

Q:xcorr function with impulse response

Q:脉冲响应函数与Xcorr

I'm trying to design a Wiener filter in Matlab for a deconvolution problem but I'm having a lot of problems. I have a gaussian white noise process with a variance of 1.2 and a impulse response which has length two. Its values are g(0) = 5 and g(1) = 4. Later on in the process I try to determine Rxx(m). For this I need to calculate g(m)*g(-m) (convolution) and have been advised to use the xcorr function in Matlab but my results don't make sense. Can anyone help me with this xcorr function and with advice on how to use this impulse response in this? I have tried working with the fourrier transforms of g but this has been no help.

我想一个反卷积问题在matlab维纳滤波器的设计但我有很多问题。我有一个高斯白噪声过程的方差为1.2和脉冲响应,长度为2。它的值是G(0)= 5和g(1)= 4。后来的过程中,我试图确定Rxx(m)。为此我需要计算G(m)×g(m)(卷积)已建议在Matlab使用Xcorr功能但我的结果没有意义。谁能帮我这Xcorr功能和建议如何在使用脉冲响应?我已经尝试用Fourrier变换G但这没有帮助的工作。

answer1: 回答1:

The following code implements only a part of what I can see in the description. It generates the noise processes and does what is described in the first part. The autocorrelation is not calculated with the filter coefficients but with the actual signal.

% generate noise process y
y = randn(1,N) * sqrt(1.2);

% filter y with the fir-filter g
g = [2, 0.6];
r = filter(g,1,y);

% generate noise process d
d = randn(1,N) * sqrt(0.2);

% x is the sum of r and d
x = r + d; 

% autocorrelation of x
[Rxx,lagRxx] = xcorr(x);

% plot autocorrelation
figure; grid on;
plot(lagRxx,Rxx);
title('Biased Autocorrelation of Signal x');
xlabel('Lag');

% cross correlation between x and y
[Rxy,lagRxy] = xcorr(x,y);

% plot crosscorrelation
figure; grid on;
plot(lagRxy,Rxy);
title('Biased Crosscorrelation of Signal x and y');
xlabel('Lag');

下面的代码只实现了我在描述中看到的部分。它产生的噪声过程,并在第一部分中所描述的。的自相关是不计算与滤波器系数,但与实际信号。

% generate noise process y
y = randn(1,N) * sqrt(1.2);

% filter y with the fir-filter g
g = [2, 0.6];
r = filter(g,1,y);

% generate noise process d
d = randn(1,N) * sqrt(0.2);

% x is the sum of r and d
x = r + d; 

% autocorrelation of x
[Rxx,lagRxx] = xcorr(x);

% plot autocorrelation
figure; grid on;
plot(lagRxx,Rxx);
title('Biased Autocorrelation of Signal x');
xlabel('Lag');

% cross correlation between x and y
[Rxy,lagRxy] = xcorr(x,y);

% plot crosscorrelation
figure; grid on;
plot(lagRxy,Rxy);
title('Biased Crosscorrelation of Signal x and y');
xlabel('Lag');
matlab  filtering  convolution