Linear Convolution. Simulation in C++ ImGui

Markus Buchholz
2 min readApr 22, 2023

The following article provides you mathematical background and especially the intuition to understand convolution. Since the convolution is applicable in a different domain, I will focus on digital signal processing only.
Convolution can be simply described as combining two signals. By simplification, we can assume that before the analog signal is processed by DSP or other processor units, the signal is sampled at a certain sampling frequency. We can consider those samples as independent impulses. In effect, impulse decomposition provides a way to analyze signals one sample at a time. Passing one simple impulse throughout the system, we investigate the output and analyze the changes. Observed changes by one impulse can be extrapolated and we can derive complete information about the whole system's behavior. This technique is called System Response Time.

Convolution. Input signal x[n] convolved with h[n]. (by author)

Convolution it that meaning gives an excellent opportunity to see how the system modifies the input. We can of course apply signal convolution for the creation of low and high-band filters.

In order to compute convolution we have to apply four particular operations, flip the input signal (here across OY axis), shift the whole signal, multiply a particular sample, and add everything. Please consider the below figures.

Schematic depicting how the convolution is applied. (by author)

Now we can run sample simulations for the signal depicted in highlighted link to Wikipedia. Consider my implementation in C++ and run the application for your own definition of the system and input signal.

Convolution. Sample 1 (by author)
Convolution. Sample 2(by author)

The source code for this article you will find on my GitHub.

The implementation of the solution I deployed in C++ with the visualization in ImGui. The introduction to the C++ ImGui and information on how to compile and build programs you will find in one of my previous articles.

Thank you for reading.

--

--

Markus Buchholz
Markus Buchholz

Written by Markus Buchholz

Researcher in underwater robotics

Responses (1)