Clear Filters
Clear Filters

Constructing a Wiener filter from its coefficients.

8 views (last 30 days)
I have some problems recreating a filter from its coefficients. For simplification, let´s say that we generate four sinusoid signals, which are later mixed:
Fs = 10000; % samples per second
dt = 1/Fs; % sapling period
StopTime = 1; % duration of the signal
t = (0:dt:StopTime-dt)'; % time vector
%Sine waves:
A = sin(20*pi*t);
B = sin(100*pi*t);
C = sin(200*pi*t);
D = sin(500*pi*t);
Z = A + B + C + D;
plot(Z)
Now, at this point, I need to extract a certain wave (for example, “A”) from the mixed signal Z. I’m aware that a low-pass filter would be interesting for this example, but for my application, I need a Wiener filter. A simple code for the Weiner filter can be found here: https://www.mathworks.com/matlabcentral/fileexchange/71440-signal-separation-with-wiener-filtering
In that code, there are three inputs and three outputs. The inputs are the mixed signal Z, the reference signal A and the order N of the filter, while the outputs are: the filtered signal, the coefficients of the filter and the mean squared error (MSE) of the solution versus the reference signal.
N = 1800 % order of the filter
[xest,b,MSE] = wienerFilt(A,Z,N)
plot(xest)
The code is executed properly and “xest” represents the signal A contained in Z.
My main objective is to reconstruct the aforementioned filter, and since the Wiener filter has a Finite Impulse Response (FIR), I use the following commands and the coefficients “b” to recreate the filter:
h = dfilt.dffir(b);
h.Arithmetic = 'fixed';
fvtool(b, 'Color', 'white')
And this is where the problems start. For starters, the fvtool displays a frequency response with three peaks, and according to their frequency relations, they represent the other three sinusoids of Z, so it’s like the opposite (inverse) of what the filter should do.
But that’s not all, because when calculating the real frequency of those peaks from their nominal/unitary representation, they appear to have shifted in frequency, which renders the filter completely useless.
Does anyone know where is the issue?

Answers (0)

Products


Release

R2019b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!