Noise Reduction

Introduction

In general people need reduce the trivial noise from their signal, there are two filters, Wiener Filter and Adaptive Filter (RLS), which I implement to my signal.

Wiener Filter

For Wiener filter, the key point is the wiener-hopf equation, consisting of auto-correlation matrix and correlation vector of noise vector and desired signal. The system is the result of the correlation vector divided by the auto-correlation, like the figure below. 

\(\begin{bmatrix} \begin{matrix} r\left[ 0 \right] & r\left[ 1 \right] \\ r\left[ -1 \right] & r\left[ 0 \right] \end{matrix} & \begin{matrix} … & r\left[ m-1 \right] \\ … & r\left[ m-2 \right] \end{matrix} \\ \begin{matrix} …. & … \\ r\left[ -(m-1) \right] & r\left[ -(m-2) \right] \end{matrix} & \begin{matrix} … & … \\ r\left[ -1 \right] & r\left[ 0 \right] \end{matrix} \end{bmatrix}\left[ \begin{matrix} h\left[ 0 \right] \\ \begin{matrix} h\left[ 1 \right] \\ … \end{matrix} \\ h\left\lceil m-1 \right\rceil \end{matrix} \right] \\ =\left[ \begin{matrix} p\left[ 0 \right] \\ p\left[ -1 \right] \\ \begin{matrix} … \\ p\left[ -\left( m-1 \right) \right] \end{matrix} \end{matrix} \right] \)

\(\ r\left[ k \right] =\frac { 1 }{ N } \sum _{ j=1 }^{ N }{ x\left[ j \right] x\left[ j-k \right] }\)

\(\ p\left[ k \right] =\frac { 1 }{ N } \sum _{ j=1 }^{ N }{ d\left[ j \right] x\left[ j-k \right] }\)

The result is the system function h[0],h[1],…h[m-1], and implementing it to reduce the noise and optimizing it in frequency domain. This is the code
According to my test, it can decrease the average square of noise from 1.03 to 0.035; equivalent to 14 dB;

Adaptive Filter (RLS)

Adaptive filter is a optimal algorithm based on adaptive filter of least square, which is fast convergence and adapts to the non-stationary of noise. The optimal method relies on the matrix inverse lemma to calculate the inverse. For  saving time, there is directly code.