3.3
This commit is contained in:
@@ -1,2 +1,55 @@
|
||||
\section{High level simulations}\
|
||||
textetxttext
|
||||
\section{High level simulations}
|
||||
The main purpose of the high-level simulations is to verify and demonstrate the theoretical approach of the previous chapters and to evaluate the performance of the proposed algorithms under various conditions. The simulations include different scenarios such as, different types of signals, various filter lengths and various step sizes. The goal is to verify different approaches before taking the step to the implementation of said algorithms on the low-power DSP.\\ \\
|
||||
The implementation is conducted in Python, which provides a flexible environment for numerical computations and data visualization. The simulation is graphically represented using the Python library Matplotlib, allowing for clear visualization of the results.
|
||||
\subsection{FIR filter implementation}
|
||||
\subsection{IIR filter implementation}
|
||||
\subsection{LMS algorithm implementation}
|
||||
The high-level implementation of the LMS algorithm follows the theoretical framework outlined in Subchapter 2.5, specificially Equation \ref{equation_lms}. The algorithm is designed to adaptively filter out noise from a desired signal using a reference noise input. The implementation of the LMS-function includes the following key steps:
|
||||
\begin{itemize}
|
||||
\item Initialization: Define vectors to store the filter coefficients, the output samples, and the updated filter coefficients over time.
|
||||
\item Filtering Process: After initially enough input samples (= number of filter coeffcients) passed the filter, for each sample in the input sample, the filter coefficients are multiplied with the corresponding reference noise samples before added to an accumulator.
|
||||
\item Error Calculation: The accumulator is then substracted from the current input sample to produce the output sample, which represents the error signal.
|
||||
\item Coefficient Update: The filter coefficients are updated by the corrector, which consists out of the error signal, scaled by the step size. The adaption step parameter allows to control how often the coefficients are updated.
|
||||
\item Iteration: Repeat the process for all samples in the input signal.
|
||||
\end{itemize}
|
||||
The flow diagram in Figure \ref{fig:fig_lms_logic} illustrates the logical flow of the LMS algorithm, while the code snippet in Figure \ref{fig:fig_lms_code} provides the concrete code implementation of the LMS-function.
|
||||
\begin{figure}[H]
|
||||
\centering
|
||||
\includegraphics[width=0.9\linewidth]{Bilder/fig_lms_logic.jpg}
|
||||
\caption{Flow diagram of the code implementation of the LMS algrotihm.}
|
||||
\label{fig:fig_lms_logic}
|
||||
\end{figure}
|
||||
\begin{figure}[H]
|
||||
\centering
|
||||
\begin{lstlisting}[language=Python]
|
||||
def lms_filter(input, ref_noise, coefficients, mu, adaption_step = 1):
|
||||
|
||||
coefficient_matrix = np.zeros((len(input), coefficients),
|
||||
dtype=np.float32)
|
||||
output = np.zeros(input.shape[0], dtype=np.float32)
|
||||
filter = np.zeros(coefficients, dtype=np.float32)
|
||||
|
||||
for j in range(0, len(input) - len(filter)):
|
||||
accumulator=0
|
||||
for i in range(coefficients):
|
||||
noise=ref_noise[j+i]
|
||||
accumulator+=filter[i] * noise
|
||||
output[j] = input[j] - accumulator
|
||||
corrector = mu * output[j]
|
||||
if (j % adaption_step) == 0:
|
||||
for k in range(coefficients):
|
||||
filter[k] += corrector*ref_noise[j+k]
|
||||
coefficient_matrix[j, :] = filter[:]
|
||||
|
||||
return output, coefficient_matrix
|
||||
\end{lstlisting}
|
||||
\label{fig:fig_lms_code}
|
||||
\caption{Code implementation of the LMS algorithm.}
|
||||
\end{figure}
|
||||
To evaltuate the performance, the LMS algorithm from Figure \ref{fig:fig_lms_code} is tested with a synthetic signal, which consists out of a chirp signal, overlain with a sine wave of 1000 Hz as noise. The reference noise input is the pure 10 Hz sine wave with the same frequency as the noise in the corrupted target signal.
|
||||
\begin{figure}[H]
|
||||
\centering
|
||||
\includegraphics[width=0.9\linewidth]{Bilder/fig_lms_simulation.png}
|
||||
\caption{LMS simulation.}
|
||||
\label{fig:fig_lms_simulation}
|
||||
\end{figure}
|
||||
Reference in New Issue
Block a user