Hello World and FFT!
What kind of content can you expect?
I'm going to break down the content into multiple categories which you will also see in the top header: normal blog posts, tips and tricks, maybe full articles, and projects.
- Blog posts: Project updates, general news and random rants.
- Tips and tricks: A collection of hardware and software engineering tricks of the trade.
- Articles: Longer and more elaborate blog posts with a more scientific touch.
- Projects: There will be static pages for my projects with all relevant information in one place, so you don't have to dig through all the blog posts.
Let's try some math formulas and syntax highlighting
There will be many occasions on which I want to show you some piece of code or a math formula, so we need to be prepared. The syntax highlighting is done with Pygments and for math formulas I'm using MathJax (maybe with SVG image fallback in the future), which both work nicely with the Pelican static site generator. Let's see an example.
Fast Fourier Transform (FFT)
The fast Fourier transform (FFT) is a fast and efficient algorithm to calculate the discrete Fourier transform (DFT) of a digital signal. The sampled signal is divided into its frequency components, thus converting it from the time domain into the frequency domain. I will not try to explain it here any further, because there is already a vast amount of information available from other sources, but here is the formula for calculating the DFT:
$$X_k = \sum_{n=0}^{N-1}x_ne^{-j2\pi kn/N}\quad(k=0,1,\ldots,N-1)$$
To calculate the FFT with Python we can import the NumPy package, so we don't have to implement it ourselves. The following code generates a sine wave, adds noise to it and calculates the FFT. Everything is plotted in three seperate graphs. Please note that for the visualization we display the absolute normalised (1 / N) FFT magnitude, in contrast to the above formula.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 |
|
Example output. The peak in the FFT magnitude for the frequency of the input signal is clearly visible despite the noise: