I implement a Wiener filter using the following code

function [h, yy, mse] = wiener_h(y,x,M)
debug = sprintf('Inverting Autocorrelation matrix..')
debug = sprintf('Crosscorrelation vector')
yx = xcorr(y,x);
yx = yx((length(yx)+1)/2:((length(yx)+1)/2)+M-1); %consider only non-negative lags
debug = sprintf('Optimal Weiner impulse response..')
h =yy*yx;
mmse = var(x)-h'*yy*h;
mse = var(x)-2*yx'*h+h'*yy*h;

where y is the input signal, x the desired output, M number of coefficients, h the optimal (wiener values) and mse the mean square error. The input to the filter is are magnitude values of a pulse (NR, SV, SA) The desired output is TX enter image description here The output of

[h, yy, mse] = wiener_h(y,x,15000)

where the number of coefficients M is equal to the number of samples N, is mse = -1.14e+03 Whereas the output of

 [h, yy, mse] = wiener_h(y,x,1500)

Where the number of coefficients is 10% of N, is mse = -7.68e+04 The plotted results of the two above (left M=N, right M=0.1N)

Can someone help me understand what's going on please? enter image description here

  • $\begingroup$ there is no jm in the code, as you mentioned its name? $\endgroup$ – Fat32 Mar 21 '17 at 13:32
  • $\begingroup$ sorry, edited to correct couple of distractions $\endgroup$ – Marco Datola Mar 21 '17 at 14:04

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.