8

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?

Thanks!

Unnamed
  • 191
  • 4
  • 3
    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? – hops Feb 25 '17 at 02:45
  • 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. – Unnamed Feb 25 '17 at 12:13
  • 2
    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. – Matt L. Feb 25 '17 at 13:06
  • Yes, I think that you're right. So the error signal $e(n)$ is $e(n) = r(n)$? How big must be $\Delta$? – Unnamed Feb 25 '17 at 13:19
  • 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)$. – Matt L. Feb 25 '17 at 13:29
  • It's been a long time since I've worked with this type of adaptive filtering system. Can you post your code? – Michael_RW Feb 28 '17 at 18:27

1 Answers1

5

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.

Matt L.
  • 89,963
  • 9
  • 79
  • 179
  • Excellent answer as always, Matt. – Jason R Feb 25 '17 at 18:14
  • 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$$

    – Unnamed Feb 25 '17 at 20:02
  • 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

    – Unnamed Feb 25 '17 at 20:07
  • 1
    @Dylan: What did you expect and what are you trying to do? – Matt L. Feb 25 '17 at 21:26
  • @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}'$$

    – Unnamed Feb 25 '17 at 21:44
  • The size of the original signal ($s(n)+r(n)$) is (76032,1), that is, 76032 rows and 1 column – Unnamed Feb 26 '17 at 02:44
  • Is this a simulation where you have access to $s(n)$ and $r(n)$? Then why don't you compute some norm of the error $s(n)-e(n)$? Of course, you always have to wait until the filter has converged. – Matt L. Feb 26 '17 at 09:28
  • No, the input signal is $u(n)=s(n)+r(n)$, and I have to "delete" the interference $r(n)$. I don't have the original $s(n)$. – Unnamed Feb 26 '17 at 13:48
  • Make sure that your filter converges. Are you sure that the RLS algorithm works properly? Look at the frequency response of the converged filter. It should have some kind of band stop characteristic, filtering out the narrow band noise. If it doesn't then it hasn't converged and any further analysis wouldn't make sense. – Matt L. Feb 26 '17 at 19:19
  • I have to cancel two interferences that are in $0.33 \pi$ and $0.56 \pi$.

    This is what I have using [h,w] = freqz(b,1,'whole'); plot(w/pi,abs(20*log10(abs(h)))) http://imgur.com/a/WUpMj

    And this is what I have using freqz(b,1): http://imgur.com/a/gZBQ5 where $b$ are the coefficients of my filter. I think that coefficients could be improved, but it seems to converge, doesn't it?

    – Unnamed Feb 26 '17 at 21:01
  • @Dylan: It doesn't look too good; I don't think that the filter works the way it should. The frequency response should be more or less constant with two notches at the interference frequencies. – Matt L. Feb 27 '17 at 21:02