# Adaptive Wiener Filter Coefficients Calculation

I want to extrapolate a signal X of length 11, using the weiner filter coefficients W of length 7. The procedure I am using is as follows:

1. Compute the autocorrelation matrix upto lag 8 .
2. Using Levinson recursion, invert the autocorrelation matrix A.
3. Multiply the matrix of cross-correlations with the inv(A) to get W
4. Obtain Extrapolated Sample=Sum(W.*Signal)

My questions is that, if now I have a new signal Y of length 15 as: Y=[X (4 new samples)]

So the Signal Y has first 11 samples of X and 4 new samples.

Now I want to compute weiner coefficients of this signal, given that I have already computed those for the signal X, can you recommend any possible approach to 'update' the filter co-efficients W given the 4 new samples, without having to do the whole weiner filter computation again thus saving some computational time?

Edit 1:

I have written the code for LMS Algorithm to iteratively 'adapt', when a new sample arrives, the filter co-efficients which were initially derived by Weiner Prediction.

The result is not same as the Weiner coefficients derived on the whole input.

The code is:

 FilterOrder=7;

 Window=7; Filter=zeros(1,FilterOrder); x = -20*%pi:0.1:20*%pi; m=length(x); StepSize=2.3e-4/1000000; data=[cos(2*x(1:floor(m/2))) cos(3.3*x(floor(m/2)+1:m))]; Filter=WeinerCtrace(data(1:Window+1),FilterOrder); // Initial Co-efficients for i=1:50 Input=data(1+i:Window+i); // Sliding Window of Filter Input DesiredOutput=data(Window+1+i); // New sample value ActualOutput=Input(Window:-1:1)*Filter'; Error=DesiredOutput-ActualOutput; while(1) NewFilter=Filter+StepSize*Error*Input; // Gradient Descent if(sum((NewFilter-Filter).^2)<1e-20) break; end Filter=NewFilter; end Filter=NewFilter; end WCoefficients=WeinerCtrace(data(1:Window+i+1),FilterOrder) Now, according to my opinion the values of WCoefficients and Filter should match as the WCoefficients are computed by applying Weiner Prediction on all the arrived data, while Filter is computed iteratively on introduction of every new sample. Edit 2: I have also implemented the RLS algorithm code given below, but the output of RLS still does not match the output of Weiner Prediction Coefficients for the same window: FilterOrder=11; Window=11; t=0:1:1000; f=linspace(.5,5,length(t)); fs=100; data=cos((%pi/fs)*(f.*t)); [Filter,P]=WeinerCtrace(data(1:Window+1),FilterOrder); w=1; plot(data,'-r'); for i=1:500 Input=data(Window+i:-1:1+i)'; // Sliding Window of Filter Input DesiredOutput=data(Window+1+i); // New sample value ActualOutput=Input'*Filter; Error=DesiredOutput-ActualOutput; K=(P*Input)/(w+(Input'*P*Input)); P=(P-(K*Input'*P))/w; Filter=Filter+(K*Error); end inp=data(i+1:Window+i+1); WC=WeinerCtrace(inp,FilterOrder) inp=data(i+1:Window+i); for j=1:100 NextValue=inp(11+j-1:-1:j)*WC; inp=[inp NextValue]; plot(Window+1+i+j,NextValue,'r+') end inp=data(Window+i:-1:1+i); for j=1:100 NextValue=inp(1:Window)*Filter; inp=[NextValue inp]; plot(Window+1+i+j,NextValue,'b*') end `

Can someone point out what am I doing wrong in the code or in anything else ? Any suggestions/idea is welcome. Thanks!

• Have you heard of the LMS algorithm? Does it help?
– Peter K.
Nov 1 '13 at 13:54
• Thanks Peter. The LMS algorithm does indeed fit in my scenario. I do not know whether it will be faster than Weiner Filter computation as we have to do Gradient Descent in LMS, can you provide your opinion about it? Nov 1 '13 at 16:59
• Recursive Least Squares also seems helpful for this scenario doesn't it ? Nov 1 '13 at 17:02
• The Wiener filter is, by definition a) not adaptive and b) not FIR / AR. You seem to want an adaptive FIR filter. There are many variants of this: LMS, NLMS, RLS (as you say), or the Kalman filter. Choose your poison! :-) ALL of them are less computationally intensive that the Wiener filter.
– Peter K.
Nov 1 '13 at 18:53
• @PeterK. Should probably post your last comment as an answer. Nov 2 '13 at 22:45

The Wiener filter is, by definition