diff --git a/Bilder/fig_lms_logic.jpg b/Bilder/fig_lms_logic.jpg new file mode 100644 index 0000000..d1c644e Binary files /dev/null and b/Bilder/fig_lms_logic.jpg differ diff --git a/Bilder/fig_lms_simulation.png b/Bilder/fig_lms_simulation.png new file mode 100644 index 0000000..33da7a8 Binary files /dev/null and b/Bilder/fig_lms_simulation.png differ diff --git a/chapter_03.tex b/chapter_03.tex index 8351372..208fc23 100644 --- a/chapter_03.tex +++ b/chapter_03.tex @@ -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} \ No newline at end of file diff --git a/chapter_04.aux b/chapter_04.aux index 5430d93..75b577d 100644 --- a/chapter_04.aux +++ b/chapter_04.aux @@ -1,10 +1,10 @@ \relax -\@writefile{toc}{\contentsline {section}{\numberline {4}Hardware and low-level simulation of different algorithm approaches}{25}{}\protected@file@percent } -\@writefile{toc}{\contentsline {subsection}{\numberline {4.1}Hardware description}{25}{}\protected@file@percent } -\@writefile{toc}{\contentsline {subsection}{\numberline {4.2}System setup}{25}{}\protected@file@percent } -\@writefile{toc}{\contentsline {subsection}{\numberline {4.3}Low-level simulations of different algorithm approaches}{25}{}\protected@file@percent } +\@writefile{toc}{\contentsline {section}{\numberline {4}Hardware and low-level simulation of different algorithm approaches}{29}{}\protected@file@percent } +\@writefile{toc}{\contentsline {subsection}{\numberline {4.1}Hardware description}{29}{}\protected@file@percent } +\@writefile{toc}{\contentsline {subsection}{\numberline {4.2}System setup}{29}{}\protected@file@percent } +\@writefile{toc}{\contentsline {subsection}{\numberline {4.3}Low-level simulations of different algorithm approaches}{29}{}\protected@file@percent } \@setckpt{chapter_04}{ -\setcounter{page}{26} +\setcounter{page}{30} \setcounter{equation}{21} \setcounter{enumi}{0} \setcounter{enumii}{0} @@ -18,7 +18,7 @@ \setcounter{subsubsection}{0} \setcounter{paragraph}{0} \setcounter{subparagraph}{0} -\setcounter{figure}{17} +\setcounter{figure}{20} \setcounter{table}{0} \setcounter{float@type}{16} \setcounter{tabx@nest}{0} @@ -136,10 +136,10 @@ \setcounter{bbx:relatedcount}{0} \setcounter{bbx:relatedtotal}{0} \setcounter{parentequation}{0} -\setcounter{lstnumber}{1} +\setcounter{lstnumber}{21} \setcounter{FancyVerbLine}{0} \setcounter{linenumber}{1} -\setcounter{LN@truepage}{25} +\setcounter{LN@truepage}{29} \setcounter{FancyVerbWriteLine}{0} \setcounter{FancyVerbBufferLine}{0} \setcounter{FV@TrueTabGroupLevel}{0} diff --git a/drawio/LMS_logic.drawio b/drawio/LMS_logic.drawio index 35cb76d..c9f8ceb 100644 --- a/drawio/LMS_logic.drawio +++ b/drawio/LMS_logic.drawio @@ -1,6 +1,6 @@ - + @@ -41,7 +41,7 @@ - + @@ -52,7 +52,7 @@ - + @@ -61,7 +61,7 @@ - + @@ -85,7 +85,7 @@ - + @@ -99,7 +99,7 @@ - + @@ -116,7 +116,7 @@ - + @@ -125,7 +125,7 @@ - + @@ -144,15 +144,15 @@ - + - + - +