Update README.md

Signed-off-by: David Rotermund <54365609+davrot@users.noreply.github.com>
This commit is contained in:
David Rotermund 2024-01-06 16:29:21 +01:00 committed by GitHub
parent 511d67cbae
commit 29a7ab89cb
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -156,29 +156,30 @@ ylabel('power');
``` ```
![Figure 9.1.](2022-04-16_00-43.png) ![Figure 9.1.](2022-04-16_00-43.png)
Figure 9.1.: Power spectrum of a step function. Figure 9.1.: Power spectrum of a step function.
## The Convolution Theorem ## The Convolution Theorem
The fast Fourier transform is not only useful to determine the frequency content of temporal signals, but also to perform so called 'convolutions'. A convolution of two functions $f(t)$ and $g(t)$ is defined by the following equation: The fast Fourier transform is not only useful to determine the frequency content of temporal signals, but also to perform so called 'convolutions'. A convolution of two functions $f(t)$ and $g(t)$ is defined by the following equation:
$h(t) = \int_{-\infty}^{+\infty} f(t') g(t-t') \, dt'$ (9.3) $$h(t) = \int_{-\infty}^{+\infty} f(t') g(t-t') \, dt'$$ (9.3)
Here, $g$ is often referred to as convolution kernel. The procedure of a convolution can be visualized as follows: We interpret $f$ as a arbitrary function, that is compared to a template function $g$. To account for possible shifts on the time axis, the template is shifted between $t=+\infty$ and $t=-\infty$ and the comparison is made at every position $t$. If both functions match perfectly, the result $h(t)$ is big. If the shifted $g$ does not match with $f$, the result is small. Here, $g$ is often referred to as convolution kernel. The procedure of a convolution can be visualized as follows: We interpret $f$ as a arbitrary function, that is compared to a template function $g$. To account for possible shifts on the time axis, the template is shifted between $t=+\infty$ and $t=-\infty$ and the comparison is made at every position $t$. If both functions match perfectly, the result $h(t)$ is big. If the shifted $g$ does not match with $f$, the result is small.
Applications of this equation are numerous in physics, and reach from simple filter operations to timely resolved frequency analysis (examples will be discussed later). First, we want to understand the connection between convolutions and the Fourier transformation. As a short notation of the application of the Fourier transform $F$ to a function $f$ (resp. its reverse transformation $F^{-1}$) we introduce: Applications of this equation are numerous in physics, and reach from simple filter operations to timely resolved frequency analysis (examples will be discussed later). First, we want to understand the connection between convolutions and the Fourier transformation. As a short notation of the application of the Fourier transform $F$ to a function $f$ (resp. its reverse transformation $F^{-1}$) we introduce:
$\hat{f}(k) = F\left.\left.\left[ f(t) \right]\right( k \right)$ $$\hat{f}(k) = F\left.\left.\left[ f(t) \right]\right( k \right)$$
$f(t) = F^{-1}\left.\left.\left[ \hat{f}(k) \right]\right( t \right)$ $$f(t) = F^{-1}\left.\left.\left[ \hat{f}(k) \right]\right( t \right)$$
Now we apply the Fourier transform to both the left and the right side of the Definition (9.3) and gain after short computation, Now we apply the Fourier transform to both the left and the right side of the Definition (9.3) and gain after short computation,
$\hat{h}(k) = 2\pi \hat{f}(k) \hat{g}(k) \, ,$ $$\hat{h}(k) = 2\pi \hat{f}(k) \hat{g}(k) \, ,$$
or, in short notation, $\hat{h} = 2\pi F[f] F[g]$. To get the sought result $h(t)$, we apply the inverse Fourier transform to the equation, which results in or, in short notation, $\hat{h} = 2\pi F[f] F[g]$. To get the sought result $h(t)$, we apply the inverse Fourier transform to the equation, which results in
$h = F^{-1}\left[ 2\pi F[f] \cdot F[g] \right] \, .$ (9.4) $$h = F^{-1}\left[ 2\pi F[f] \cdot F[g] \right] \, .$$ (9.4)
The advantage of equation (9.4) over (9.3) lies in the computation speed of FFT: despite a three-fold transformation, calculating equation (9.4) is faster than computing the integral in (9.3), since the convolution integral corresponds to an element-wise multiplication of the Fourier coefficients in the Fourier space $k$ -- try to verify! The advantage of equation (9.4) over (9.3) lies in the computation speed of FFT: despite a three-fold transformation, calculating equation (9.4) is faster than computing the integral in (9.3), since the convolution integral corresponds to an element-wise multiplication of the Fourier coefficients in the Fourier space $k$ -- try to verify!
@ -246,6 +247,7 @@ To end this section, some further examples for the application of the convolutio
Fourier transformations are ill suited for signals, whose spectrum changes over time. This also includes signals which do contain periodic oscillations, but where the frequency is subject to fluctuations. In wavelet transformations, a signals is convoluted with a filter $g$, that only contains few oscillations of a specific period and decays to 0 outside of this range. An example is depicted in the following picture: Fourier transformations are ill suited for signals, whose spectrum changes over time. This also includes signals which do contain periodic oscillations, but where the frequency is subject to fluctuations. In wavelet transformations, a signals is convoluted with a filter $g$, that only contains few oscillations of a specific period and decays to 0 outside of this range. An example is depicted in the following picture:
![Figure 9.4.](2022-04-16_01-04.png) ![Figure 9.4.](2022-04-16_01-04.png)
Figure 9.4.: Wavelet filter $g(t)$ for the frequency analysis of non-stationary signals Figure 9.4.: Wavelet filter $g(t)$ for the frequency analysis of non-stationary signals
@ -276,7 +278,7 @@ Again, $w$ can be interpreted as a filter. With this insight, the inner integral
When the stimulus $s(x, y, t)$ and the response $r(t)$ is known, the unknown filter $w$ can be determined under special conditions. This becomes specifically easy, when the stimulus is uncorrelated white noise: When the stimulus $s(x, y, t)$ and the response $r(t)$ is known, the unknown filter $w$ can be determined under special conditions. This becomes specifically easy, when the stimulus is uncorrelated white noise:
$w(x, y, \tau) \propto \int r(t) s(x, y, t-\tau) dt$ $$w(x, y, \tau) \propto \int r(t) s(x, y, t-\tau) dt$$
After application of the convolution theorem, we get: After application of the convolution theorem, we get:
@ -289,7 +291,7 @@ $$\tau\dot{A}(x, t) = -A(x, t)+g[ I(x, t) ]$$
$I(x, t)$ denotes the incoming current of the neuron at position $x$ ; this is a sum across the weighted activities of all other neurons: $I(x, t)$ denotes the incoming current of the neuron at position $x$ ; this is a sum across the weighted activities of all other neurons:
$I(x, t) = \int w(x, x') A(x', t) dx'$ $$I(x, t) = \int w(x, x') A(x', t) dx'$$
If the weight are invariant to translation via $w(x, x') = w(x-x')$ , the solution of this integral is again a case for the well known convolution theorem. If the weight are invariant to translation via $w(x, x') = w(x-x')$ , the solution of this integral is again a case for the well known convolution theorem.
@ -372,6 +374,7 @@ xlabel('x'); ylabel('\rho_{normal}(x)');
``` ```
![Figure 9.5.](2022-04-16_01-09.png) ![Figure 9.5.](2022-04-16_01-09.png)
Figure 9.5.: Uniform and normal distribution. Figure 9.5.: Uniform and normal distribution.
@ -382,6 +385,7 @@ To generate random numbers from arbitrary distributions $\rho(x)$, we will schem
Let $\rho_{max}$ be the maximum of the distribution $\rho$. To generate random numbers from $\rho(x)$, we have to make sure that the value $x$ occurs with the relative frequency $\rho(x)/\rho_{max}$. This can be assured by a simple procedure that uses the random number generator for uniformly distributed random numbers: we first draw a candidate $x_1$ for a random number from the area of definition of $\rho(x)$. Then we draw a second number $x_2$ from $[0, 1[$. If this one is smaller than $\rho(x_1)/\rho_{max}$, the first number is accepted, otherwise the procedure is repeated. See also the following picture: only pairs of numbers $(x_1, x_2)$ are accepted, that fall into the area under the renormalized distribution $\rho$. Let $\rho_{max}$ be the maximum of the distribution $\rho$. To generate random numbers from $\rho(x)$, we have to make sure that the value $x$ occurs with the relative frequency $\rho(x)/\rho_{max}$. This can be assured by a simple procedure that uses the random number generator for uniformly distributed random numbers: we first draw a candidate $x_1$ for a random number from the area of definition of $\rho(x)$. Then we draw a second number $x_2$ from $[0, 1[$. If this one is smaller than $\rho(x_1)/\rho_{max}$, the first number is accepted, otherwise the procedure is repeated. See also the following picture: only pairs of numbers $(x_1, x_2)$ are accepted, that fall into the area under the renormalized distribution $\rho$.
![Figure 9.6.](2022-04-16_01-10.png) ![Figure 9.6.](2022-04-16_01-10.png)
Figure 9.6.: Hit-and-miss method: draw two uniformly distributed random numbers $x_1$ and $x_2$, and accept $x_1$ if both numbers fall into the blue area. By this, the probability distribution marked by the red line. Figure 9.6.: Hit-and-miss method: draw two uniformly distributed random numbers $x_1$ and $x_2$, and accept $x_1$ if both numbers fall into the blue area. By this, the probability distribution marked by the red line.
@ -410,6 +414,7 @@ $$Y(x;a_1,a_2) = a_1+a_2 x$$
to a data set. to a data set.
![Figure 9.7.](2022-04-16_01-13.png) ![Figure 9.7.](2022-04-16_01-13.png)
Figure 9.7.: Fitting a curve to data points. Figure 9.7.: Fitting a curve to data points.
It is the aim to adjust the values of these parameters such that the function $Y(x;a_1,\ldots,a_M)$ represents the date as well as possible. Intuitively we would assume that in case a fit is good, the graph of the function $Y(x;a_1,\ldots,a_M)$ will lie close to the points $(x_i,y_i)$ (see figure 9.7). We can quantify this statement by measuring the deviations between the data points and the function It is the aim to adjust the values of these parameters such that the function $Y(x;a_1,\ldots,a_M)$ represents the date as well as possible. Intuitively we would assume that in case a fit is good, the graph of the function $Y(x;a_1,\ldots,a_M)$ will lie close to the points $(x_i,y_i)$ (see figure 9.7). We can quantify this statement by measuring the deviations between the data points and the function
@ -472,6 +477,7 @@ $$\hat{x}_k = {1 \over 2\pi} \int_{0}^{2\pi} x(t') \exp\left( -ikt' \right) \, d
Here the fit parameters are $a_1 = 0.1529 \pm 0.2633$ and $a_2 = 1.0939\pm 0.0670$. Note that the error bars $\sigma_{a_j}$ do not depend on the $y_i$. These error bars are thus no quantifier of the goodness of the fit. Here the fit parameters are $a_1 = 0.1529 \pm 0.2633$ and $a_2 = 1.0939\pm 0.0670$. Note that the error bars $\sigma_{a_j}$ do not depend on the $y_i$. These error bars are thus no quantifier of the goodness of the fit.
![Figure 9.8.](2022-04-16_01-20.png) ![Figure 9.8.](2022-04-16_01-20.png)
Figure 9.8.: An example of linear regression. A straight line $Y(x)$ is fitted to the data points $(x_i,y_i)$. Figure 9.8.: An example of linear regression. A straight line $Y(x)$ is fitted to the data points $(x_i,y_i)$.
### Goodness of the Fit ### Goodness of the Fit