Fourier Series analysis is one of the basic topics in Signals and Systems. It is also one of the topics that I have tutored. So, it gets to be the first blog post! Fourier Series analysis deconstructs periodic signals into sinusoidal components. Analysis involves calculating Fourier coefficients. Then comes the Fourier Series, or synthesis, where we reconstruct the signal by writing the signal as a sum of sinusoidal components scaled with the Fourier coefficients. But, before we can start calculating Fourier coefficients, we first need to define the signal. In this blog, you will learn:

  • How to define a piece-wise function in MATLAB
  • Logical indexing
  • Element wise verses matrix multiplication
  • Integration using rectangular approximation
  • Line and stem plots
  • How the number of harmonics included in the Fourier series approximation effects the accuracy
  • Optimizing your code using symmetries
  • Application of Fourier Series analysis to an ECG signal

MATLAB has introduced a new interactive editor called Live Editor. It has become my favorite tool for tutoring since it helps me quickly try different methods and demonstrate coding patterns effectively. I generated the following PDF by publishing the Live Script. You can download the MATLAB code for Fourier series from my GitHub repository. It also includes an app to explore Fourier series properties using MATLAB.

fourier_series_final

You can watch how I started to construct this code in the following video.

Here is a Cody problem for calculating the Fourier series coefficients. Give it a try and see if you can get the right answer with the least amount of code!

Please let me know what you think using the comments section. Start your MATLAB and try the code. Change some parameters and explore Fourier Series yourself. Define different functions.

Keep Exploring!

Leave a Reply

Your email address will not be published. Required fields are marked *