I'm trying to find the optimum filter length for an Adaptive Filtering, using RLS Algorithm.

I'm using this design:

So the "error" signal is the signal without noise (and that's the signal that I want).

If I have $e(n) = d(n)-y(n)$ but $d(n)$ is my desired signal, I need that $e(n) \rightarrow 0$ so I find the optimum filter length (and the delay) using the MSE criterion, but now I have the signal that I want as the error, so I don't know how to find the optimum filter length, because I have NO idea what MSE do I have to get at the output!

Can anyone tell me what should I do?


  • 3
    $\begingroup$ In general, this seems like a good question, but your diagram is confusing to me. For example, you will never remove the narrow-band interference using the combined signal for $d(n)$... Was this intentional? Also, you know the transfer function of your system $G(z) = z^{-\Delta}$, so why do you need an adaptive filter? $\endgroup$
    – hops
    Feb 25, 2017 at 2:45
  • $\begingroup$ The adaptive filter filters the signal that is uncorrelated with the input. When you add a delay, the delayed noise is uncorrelated with the original noise, but the delayed $s(n)$ is still correlated with the original $s(n)$, that's why the noise is filtered. Isn't it? That design is from the MIT. $\endgroup$
    – Unnamed
    Feb 25, 2017 at 12:13
  • 2
    $\begingroup$ OK, I see, but for this to work the delay $\Delta$ must be large enough such that the desired signal $s(n)$ is uncorrelated with the delayed signal at the input of the filter. In that case the filter will predict the interference. Note that it's not the noise (as you wrote in the comment) but the desired signal that needs to be uncorrelated with the delayed signal. $\endgroup$
    – Matt L.
    Feb 25, 2017 at 13:06
  • $\begingroup$ Yes, I think that you're right. So the error signal $e(n)$ is $e(n) = r(n)$? How big must be $\Delta$? $\endgroup$
    – Unnamed
    Feb 25, 2017 at 13:19
  • $\begingroup$ No, $e(n)\approx s(n)$ and $y(n)\approx r(n)$. The delay $\Delta$ must be chosen such that the autocorrelation of the desired signal is (close to) zero for lags $\ge\Delta$, such that $s(n)$ becomes uncorrelated with the input $f(n)$ to the filter. So the choice of $\Delta$ depends on the properties of $s(n)$. $\endgroup$
    – Matt L.
    Feb 25, 2017 at 13:29

1 Answer 1


In order to be able to choose an optimal value for the delay $\Delta$ it's important to understand how the system works. The purpose of the delay is to decorrelate the desired signal $s(n)$ and the signal component $s(n-\Delta)$ at the input of the adaptive filter. This means that $\Delta$ must be chosen such that the autocorrelation $R_{ss}(k)$ of $s(n)$ is (close to) zero for lags greater than $\Delta$:

$$R_{ss}(k)\approx 0,\qquad |k|>\Delta$$

However, we cannot choose $\Delta$ arbitrarily large because the delayed interference at the input of the filter must be correlated with the interference added to the signal, i.e., the autocorrelation $R_{rr}(k)$ of the interference must still be significant at a lag of $\Delta$, otherwise the adaptive filter cannot predict the interference. If we can assume that $r(n)$ is narrow-band compared to $s(n)$, it's always possible to find an appropriate value for $\Delta$.

With an appropriate value for $\Delta$, the adaptive filter will try to predict the interference, i.e., it will try to undo the effect of the delay in the frequency band where the interference has significant frequency components. So the output of the filter will approximate $r(n)$: $y(n)\approx r(n)$. Consequently, the error signal will approximate the desired signal: $e(n)\approx s(n)$.

After having chosen a value for $\Delta$ based on the autocorrelation of $s(n)$, the filter length must be chosen by trial and error. A long filter will give a better suppression at the cost of slower convergence.

  • $\begingroup$ Excellent answer as always, Matt. $\endgroup$
    – Jason R
    Feb 25, 2017 at 18:14
  • $\begingroup$ Thanks Matt, I understood a lot of things! But I still have some problems. Saying that $e(n) \approx s(n)$, and $e(n)$ is the one that I see in the Figure that I put on the main post, I calculate the autocorrelation as: $$R_{ss} = \sum_{n=1}^{L} e(n) e*(n)$$ but I have some results that are a bit confusing: with filter length $M=50$ I have: $$\Delta=2 \rightarrow R=0.1950 \\ \Delta=5 \rightarrow R=0.4566 \\ \Delta=10 \rightarrow R=0.1396 \\ \Delta=11 \rightarrow R=0.5913 \\ \Delta=12 \rightarrow R=0.0588 \\ \Delta=13 \rightarrow R=0.1.9348 \\ \Delta=30 \rightarrow R=0.7577$$ $\endgroup$
    – Unnamed
    Feb 25, 2017 at 20:02
  • $\begingroup$ and if I take $M=20$ I have $$\Delta=2 \rightarrow R=0.2310 \\ \Delta=5 \rightarrow R=0.4435 \\ \Delta=10 \rightarrow R=0.9420 \\ \Delta=30 \rightarrow R=0.2.5122$$ I don't know what to do. I didn't expect those results :S $\endgroup$
    – Unnamed
    Feb 25, 2017 at 20:07
  • 1
    $\begingroup$ @Dylan: What did you expect and what are you trying to do? $\endgroup$
    – Matt L.
    Feb 25, 2017 at 21:26
  • $\begingroup$ @MattL.: I thought that, for the same filter length, I would have a smaller autocorrelation when the delay $\Delta$ was bigger. I calculate $e(n)$ from that design that I showed in the main post, and I delayed that signal in MATLAB like this: $$e_{delayed} = zeros(1,length(e)); \\ for \ i=(\Delta+1):L \\ e_{delayed}(i)=e(i-\Delta); \\ end$$ and then, to calculate the autocorrelation: $$autocorr=e*e_{delayed}'$$ $\endgroup$
    – Unnamed
    Feb 25, 2017 at 21:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.