# Fourier Series

### Analytical View

Physical signals that are measurable, such as temperature, pressure, voice and sound etc. though arbitrary in nature, must be defined as mathematical functions if further processing is required. The processing of the signals could mean anything, from removing the unwanted noise from the speach to designing a control system for maintaining a constant action.

The central idea of the Fourier Series is to find a waveform that fit the data set, as if looking at these events as a function made up of superimposed sinusoidal waves. How to identify the amplitude and frequency of the waves is the topic of discussion in this article.

Fig. 1.1

We will use an example set of data as shown in Table 1.1 and formulate a set of sinusoidal function to describe the data set.

Given an arbitrary function the task is,

• To find the starting or the fundamental frequency and the subsequent frequencies that made the waveform.
• To find the total number of waves in the series
• To find the coefficients or the amplitudes of the sin and cos waves in the series.
• To find the dc-component of the series that would shift the entire waveform above or below the baseline.

$$\\ \\ T=1/f=1sec/cycle$$

$$\\ \Delta T=1/16=0.0625sec \\$$

Table 1.1

$$\\ \begin{tabular}{cccc} K & k\Delta T & 2\pi fk\Delta T & f(k\Delta T) \\ \hline 0 & 0 & 0 & 7.50 \\ 1 & 0.0625 & 0.4 & 7.32 \\ 2 & 0.125 & 0.8 & 5.27 \\ 3 & 0.1875 & 1.2 & 4.04 \\ 4 & 0.25 & 1.6 & 4.70 \\ 5 & 0.3125 & 2 & 5.50 \\ 6 & 0.375 & 2.4 & 4.27 \\ 7 & 0.4375 & 2.8 & 1.38 \\ 8 & 0.5 & 3.2 & -0.50 \\ 9 & 0.5625 & 3.6 & 0.39 \\ 10 & 0.625 & 4 & 2.73 \\ 11 & 0.6875 & 4.4 & 3.66 \\ 12 & 0.75 & 4.8 & 2.30 \\ 13 & 0.8125 & 5.2 & 0.79 \\ 14 & 0.875 & 5.6 & 1.73 \\ 15 & 0.9375 & 6 & 4.91 \\ \hline \end{tabular}$$

The staring point is to determine the fundamental frequency of the sinusoidal waves that made the desired waveform.

Even if the function is not a waveform, we can restrict our analysis by choosing a domain of interest and analyze its constituent frequencies.

A waveform that starts with 0 heights may only have the sin components and not the cosine components; since adding cosine functions would force the waveform to start with a value other then 0 and that would defeat the purpose of synthesizing the desired waveform. If a waveform starts with value other than 0, it means it has both sin and cos functions. Also notice, the period of one complete cycle of the waveform, it should be same as the period of the sin function, otherwise we would end up with the situation where ends don’t meet. This also forces the subsequent functions to have frequencies that is integral multiples of the fundamental frequency, otherwise the ends would not meet.

Thus: the period of the starting sinusoidal would be equal to the period of the arbitrary waveform and subsequent frequencies would be integral multiple of the fundamental, called harmonics.

Fig. 1.2

Let's assume there is a set of sinusoidal functions that sum up to match the set of data (equation 1.1),
$$\\ f(t) = c+\sum\limits_{n=1}^? a_n sin(\omega_n t) + \sum\limits_{n=1}^? b_n cos(\omega_n t)\right) \hdots \hdots \hdots(1.1)\\ \\$$

Notice the unknowns in equation 1.1 that must be determined:

• The angular frequencies starting from $$\omega_1$$ to $$\omega_n$$,
• The question mark as the upper limit of the sum,
• The sin and cos coefficients $$a_n$$ and $$b_n$$
• The constant $$c$$ also called dc-component.

Fig. 1.3

Before we start the process of identifying the unknowns, the equation 1.1 should be modified to reflect the discrete time processing as we are using a computer to process the data.

The time $$t$$ is valid only at the instance when we have acquired the sample data.
If $$k$$ is the sample number and $$\Delta T$$ is the time interval between samples then the continuous time $$t$$ is equivalent of discrete time $$k\Delta T$$.

The period for one complete cycle is $$T$$ and the frequency $$f=1/T$$ and $$\omega=2\pi/T$$.
And the domain $$\omega t= 2\pi(k\Delta T/T)$$.

And the discrete time equivalent of equation 1.1 may be described as,

$$f(k\Delta T) = c + \sum\limits_{n=1}^? a_n sin(n2\pi k\Delta T/T) + \sum\limits_{n=1}^? b_n cos(n2\pi k\Delta T/T)\right) \hdots \hdots \hdots(1.2)\\$$

It is worth mentioning that according to Fourier, infinite number of frequencies are required in order to truely describe a function as sum of sinusoidals; but this is not practical and not required. It has been determined that the highest frequency we can identify (also called Nyquist Frequency) is half the number of samples in a sample set. Thus: if we have 16 samples then we only need to identify 8 frequencies in order to describe the underline waveform.

Let us formulate a set of sinusoidal function to describe the Table 1.1 data set. The discrete time parameters of data are as follows:

$$K=16 \cdots number of samples\\ k=0..K-1\\ n = 8\hdots Nyquist Frequency \\ T=1sec\\ \Delta T = 1/16 = 0.0625sec\\ t = k\Delta T = 0.0625k sec\\ \omega t = 2\pi (k\Delta T/T) = 0.4k radians\\$$

The equation 1.2 may be simplified as $$f(0.0625k) = c + \sum\limits_{n=1}^8 a_n sin(nk0.4) + \sum\limits_{n=1}^8 b_n cos(nk0.4) \hdots \hdots \hdots(1.2)\\$$

And the continuous time Fourier Series would be $$\\ f(t) = c+\sum\limits_{n=1}^{\infty} a_n sin(\omega_n t) + \sum\limits_{n=1}^{\infty} b_n cos(\omega_n t)\right) \hdots \hdots \hdots(1.1)\\ \\$$

Table 1.1
$$\\ \begin{tabular}{cccc} k & k\Delta T & 2\pi fk\Delta T & f(k\Delta T) \\ \hline 0 & 0 & 0 & 7.50 \\ 1 & 0.0625 & 0.4 & 7.32 \\ 2 & 0.125 & 0.8 & 5.27 \\ 3 & 0.1875 & 1.2 & 4.04 \\ 4 & 0.25 & 1.6 & 4.70 \\ 5 & 0.3125 & 2 & 5.50 \\ 6 & 0.375 & 2.4 & 4.27 \\ 7 & 0.4375 & 2.8 & 1.38 \\ 8 & 0.5 & 3.2 & -0.50 \\ 9 & 0.5625 & 3.6 & 0.39 \\ 10 & 0.625 & 4 & 2.73 \\ 11 & 0.6875 & 4.4 & 3.66 \\ 12 & 0.75 & 4.8 & 2.30 \\ 13 & 0.8125 & 5.2 & 0.79 \\ 14 & 0.875 & 5.6 & 1.73 \\ 15 & 0.9375 & 6 & 4.91 \\ \hline \end{tabular}$$

Now comes the difficult part of identifying the coefficients $$a,b,c$$.

This is where Fourier's genius come into play. Notice that sinusoidal functions have two halves, one half is positive and the other half is negative. If we integrate the area for one complete cycle, the sum would be zero, but if we multiply the function with itself, both halves will have positive areas and that would be equal to twice the coefficient of the sinusoidal. This fact is only true if the frequency is same, multiplying with any other frequency and integrating will result in area equal to 0.

The property of sinusoidal where multiplying and integrating results in 0 area except when frequency is same is the orthogonal property.

Fig. 1.4

The square integral of the trigonometric function acts like a filter of frequency where only the matching frequency survives and the rests are vanished. You can see this graphically as shown below. The function $$a_n sin(\omega_t)$$ was multiplied by $$sin(\omega_t)$$ and integrated for one complete cycle $$0..2\pi$$ or period $$T$$.

 $$\\ f(t) = {sin(\omega t)}$$ $$\\ f(t) = {sin(\omega t) \times sin(\omega t) }$$ $$\\ \cdots$$ $$\\ f(t) = {sin(\omega t) \times sin(2 \omega t) }$$ $$\begin{tikzpicture}[xscale=1] \begin{pgfpicture} \pgfpathmoveto{\pgfpoint{0cm}{0cm}} \pgfpathsine{\pgfpoint{1cm}{-1cm}} \pgfpathcosine{\pgfpoint{1cm}{1cm}} \pgfpathsine{\pgfpoint{1cm}{1cm}} \pgfpathcosine{\pgfpoint{1cm}{-1cm}} \pgfsetfillcolor{yellow!80!black} \pgfusepath{fill,stroke} \end{pgfpicture} \end{tikzpicture}$$ $$\begin{tikzpicture}[xscale=1] \begin{pgfpicture} \pgfpathmoveto{\pgfpoint{0cm}{0cm}} \pgfpathsine{\pgfpoint{1cm}{-0.7cm}} \pgfpathcosine{\pgfpoint{1cm}{0.7cm}} \pgfpathsine{\pgfpoint{1cm}{-0.7cm}} \pgfpathcosine{\pgfpoint{1cm}{0.7cm}} \pgfsetfillcolor{yellow!80!black} \pgfusepath{fill,stroke} \end{pgfpicture} \end{tikzpicture}$$ $$\\ \cdots$$ $$\begin{tikzpicture}[xscale=1] \begin{pgfpicture} \pgfpathmoveto{\pgfpoint{0cm}{0cm}} \pgfpathsine{\pgfpoint{0.5cm}{-0.7cm}} \pgfpathcosine{\pgfpoint{0.5cm}{0.7cm}} \pgfpathsine{\pgfpoint{0.5cm}{0.7cm}} \pgfpathcosine{\pgfpoint{0.5cm}{-0.7cm}} \pgfpathsine{\pgfpoint{0.5cm}{-0.7cm}} \pgfpathcosine{\pgfpoint{0.5cm}{0.7cm}} \pgfpathsine{\pgfpoint{0.5cm}{0.7cm}} \pgfpathcosine{\pgfpoint{0.5cm}{-0.7cm}} \pgfsetfillcolor{yellow!80!black} \pgfusepath{fill,stroke} \end{pgfpicture} \end{tikzpicture}$$

The area produced by the square integration would be equal to half the area of the rectangle formed where length = $$T$$, Using the orthogonal property Fourier extracted the coefficients $$a$$ and $$b$$ using the following mathematical operation:

$$\\ Area = {a_n \times T\over 2}$$ $$\begin{tikzpicture} \draw [help lines] (0,0) grid (4,2); \draw [blue, thick, x=.011cm, y=1cm, declare function={ sines(\t)=1 + (sin(\t) * sin(\t)); }] plot [domain=0:360, samples=180, smooth] (\x,{sines(\x)}); \node (a) at (4,1) {\textit T}; \node (b) at (1,2) {a_n}; \end{tikzpicture}$$

Fig. 1.5

For continuous time sin functions:

$$\\ a_n=1/\pi \int\limits_{t=0}^{2\pi} f(t) sin(\omega_n t) dt$$

And for continuous time cos functions:

$$\\ b_n=1/\pi \int\limits_{t=0}^{2\pi} f(t) cos(\omega_n t) dt$$

For discrete time function the integration is performed by summing the area of rectangles formed at each discrete interval as shown in Fig 1.3.

For discrete time sin functions:

$$\\ Area = {a_n \times T\over 2} = \sum\limits_{k=0}^{K-1} {f(k\Delta T) \times sin({n2\pi \over T} k\Delta T ) \times \Delta T}\\$$

For discrete time cos functions:

$$\\ Area = {b_n \times T\over 2} = \sum\limits_{k=0}^{K-1} {f(k\Delta T) \times cos({n2\pi \over T} k\Delta T ) \times \Delta T}\\$$

Fig. 1.6

The coefficient $$c$$ or the dc-constant.

Finding the coefficient $$c$$ is relatively simple. We know the effect, presence of a constant in a waveform shifts the entire wave either below or above the base line. If we did'nt have the dc constant, the area under the curve of the complex wave would be equal to 0 over one complete period. Any non-zero value for the area indicates contribution of the dc component to the complex wave.

The constant $$c$$ is obtained by the dividing the area with the width, as:

$$height = {Area \over width}$$.

To find the area, we can integrate the function over one period; for continuous time function:

$$\\ c={1 \over 2\pi}{\int\limits_{t=0}^{2\pi} f(t) dt}$$

For discrete time function simply add all the little rectangles formed when sample point is multiplied by $$\Delta T$$ and sum all the areas.

$$\\ c ={1\over T} {\sum\limits_{k=0}^{K-1} f(k\Delta T) \times \Delta T}\\$$

Fig. 1.7

Finding the coefficients $$a,b$$ and $$c$$ is a computationally intensive process as the multiply and add operation must be repeated for each sample and repeated for each each frequncy in the system up to the Nyquist Frequency.

The sin coefficients $$a_1 \cdots a_8$$ are computed as follows:

$$a_1 = 2 \times {\sum\limits_{k=0}^{15} f(k \Delta T) \times sin(1 \times 2\pi k\Delta T) \times \Delta T}\\ a_2 = 2 \times {\sum\limits_{k=0}^{15} f(k \Delta T) \times sin(2 \times 2\pi k\Delta T) \times \Delta T}\\ a_3 = 2 \times {\sum\limits_{k=0}^{15} f(k \Delta T) \times sin(3 \times 2\pi k\Delta T) \times \Delta T}\\ a_4 = 2 \times {\sum\limits_{k=0}^{15} f(k \Delta T) \times sin(4 \times 2\pi k\Delta T) \times \Delta T}\\ a_5 = 2 \times {\sum\limits_{k=0}^{15} f(k \Delta T) \times sin(5 \times 2\pi k\Delta T) \times \Delta T}\\ a_6 = 2 \times {\sum\limits_{k=0}^{15} f(k \Delta T) \times sin(6 \times 2\pi k\Delta T) \times \Delta T}\\ a_7 = 2 \times {\sum\limits_{k=0}^{15} f(k \Delta T) \times sin(7 \times 2\pi k\Delta T) \times \Delta T}\\ a_8 = 2 \times {\sum\limits_{k=0}^{15} f(k \Delta T) \times sin(8 \times 2\pi k\Delta T) \times \Delta T}\\$$

The following table shows the calculations and the resultant coefficients for sin functions in the waveform

$$\begin{tabular}{|c|c|c|c|c|c|c|c|c|c|} \hline k & f(kDT) & a_1 & a_2 & #a_3 & a_4 & a_5 & a_6 & a_7 & a_8\\ \hline 0 &7.5 &0.00 &0.00 &0.00 &0.00 &0.00 &0.00 &0.00 &0.00\\ \hline 1 &7.32 &0.35 &0.65 &0.85 &0.92 &0.85 &0.65 &0.35 &0.00\\ \hline 2 &5.27 &0.47 &0.66 &0.47 &0.00 &-0.47 &-0.66 &-0.47 &0.00\\ \hline 3 &4.04 &0.47 &0.36 &-0.19 &-0.51 &-0.19 &0.36 &0.47 &0.00\\ \hline 4 &4.7 &0.59 &0.00 &-0.59 &0.00 &0.59 &0.00 &-0.59 &0.00\\ \hline 5 &5.5 &0.64 &-0.49 &-0.26 &0.69 &-0.26 &-0.49 &0.64 &0.00\\ \hline 6 &4.27 &0.38 &-0.53 &0.38 &0.00 &-0.38 &0.53 &-0.38 &0.00\\ \hline 7 &1.38 &0.07 &-0.12 &0.16 &-0.17 &0.16 &-0.12 &0.07 &0.00\\ \hline 8 &-0.5 &0.00 &0.00 &0.00 &0.00 &0.00 &0.00 &0.00 &0.00\\ \hline 9 &0.39 &-0.02 &0.03 &-0.05 &0.05 &-0.05 &0.03 &-0.02 &0.00\\ \hline 10 &2.73 &-0.24 &0.34 &-0.24 &0.00 &0.24 &-0.34 &0.24 &0.00\\ \hline 11 &3.66 &-0.42 &0.32 &0.18 &-0.46 &0.18 &0.32 &-0.42 &0.00\\ \hline 12 &2.3 &-0.29 &0.00 &0.29 &0.00 &-0.29 &0.00 &0.29 &0.00\\ \hline 13 &0.79 &-0.09 &-0.07 &0.04 &0.10 &0.04 &-0.07 &-0.09 &0.00\\ \hline 14 &1.73 &-0.15 &-0.22 &-0.15 &0.00 &0.15 &0.22 &0.15 &0.00\\ \hline 15 &4.91 &-0.23 &-0.43 &-0.57 &-0.61 &-0.57 &-0.43 &-0.23 &0.00\\ \hline & & 1.50 & 0.50 & 0.30 & 0.00 & 0.00 & 0.00 & 0.00 & 0.00\\ \hline \end{tabular}$$

Using the same methodology the cos coefficients $$b_1 \cdots b_8$$ are computed as follows:

$$b_1 = 2 \times {\sum\limits_{k=0}^{15} f(k \Delta T) \times cos(1 \times 2\pi k\Delta T) \times \Delta T}\\ b_2 = 2 \times {\sum\limits_{k=0}^{15} f(k \Delta T) \times cos(2 \times 2\pi k\Delta T) \times \Delta T}\\ b_3 = 2 \times {\sum\limits_{k=0}^{15} f(k \Delta T) \times cos(3 \times 2\pi k\Delta T) \times \Delta T}\\ b_4 = 2 \times {\sum\limits_{k=0}^{15} f(k \Delta T) \times cos(4 \times 2\pi k\Delta T) \times \Delta T}\\ b_5 = 2 \times {\sum\limits_{k=0}^{15} f(k \Delta T) \times cos(5 \times 2\pi k\Delta T) \times \Delta T}\\ b_6 = 2 \times {\sum\limits_{k=0}^{15} f(k \Delta T) \times cos(6 \times 2\pi k\Delta T) \times \Delta T}\\ b_7 = 2 \times {\sum\limits_{k=0}^{15} f(k \Delta T) \times cos(7 \times 2\pi k\Delta T) \times \Delta T}\\ b_8 = 2 \times {\sum\limits_{k=0}^{15} f(k \Delta T) \times cos(8 \times 2\pi k\Delta T) \times \Delta T}\\$$

The following table shows the calculations and the resultant coefficients for cos functions in the waveform

$$\begin{tabular}{|c|c|c|c|c|c|c|c|c|c|} \hline k & f(kDT) & b_1 & b_2 & #b_3 & b_4 & b_5 & b_6 & b_7 & b_8\\ \hline 0 & 7.5 & 0.94 & 0.94 & 0.94 & 0.94 & 0.94 & 0.94 & 0.94 & 0.94 \\ \hline 1 & 7.32 & 0.85 & 0.65 & 0.35 & 0.00 & -0.35 & -0.65 & -0.85 & -0.92 \\ \hline 2 & 5.27 & 0.47 & 0.00 & -0.47 & -0.66 & -0.47 & 0.00 & 0.47 & 0.66 \\ \hline 3 & 4.04 & 0.19 & -0.36 & -0.47 & 0.00 & 0.47 & 0.36 & -0.19 & -0.51 \\ \hline 4 & 4.7 & 0.00 & -0.59 & 0.00 & 0.59 & 0.00 & -0.59 & 0.00 & 0.59 \\ \hline 5 & 5.5 & -0.26 & -0.49 & 0.64 & 0.00 & -0.64 & 0.49 & 0.26 & -0.69 \\ \hline 6 & 4.27 & -0.38 & 0.00 & 0.38 & -0.53 & 0.38 & 0.00 & -0.38 & 0.53 \\ \hline 7 & 1.38 & -0.16 & 0.12 & -0.07 & 0.00 & 0.07 & -0.12 & 0.16 & -0.17 \\ \hline 8 & -0.5 & 0.06 & -0.06 & 0.06 & -0.06 & 0.06 & -0.06 & 0.06 & -0.06 \\ \hline 9 & 0.39 & -0.05 & 0.03 & -0.02 & 0.00 & 0.02 & -0.03 & 0.05 & -0.05 \\ \hline 10 & 2.73 & -0.24 & 0.00 & 0.24 & -0.34 & 0.24 & 0.00 & -0.24 & 0.34 \\ \hline 11 & 3.66 & -0.18 & -0.32 & 0.42 & 0.00 & -0.42 & 0.32 & 0.18 & -0.46 \\ \hline 12 & 2.3 & 0.00 & -0.29 & 0.00 & 0.29 & 0.00 & -0.29 & 0.00 & 0.29 \\ \hline 13 & 0.79 & 0.04 & -0.07 & -0.09 & 0.00 & 0.09 & 0.07 & -0.04 & -0.10 \\ \hline 14 & 1.73 & 0.15 & 0.00 & -0.15 & -0.22 & -0.15 & 0.00 & 0.15 & 0.22 \\ \hline 15 & 4.91 & 0.57 & 0.43 & 0.23 & 0.00 & -0.23 & -0.43 & -0.57 & -0.61 \\ \hline & & 2.00 & 0.00 & 2.00 & 0.00 & 0.00 & 0.00 & 0.00 & 0.00 \\ \hline \end{tabular}$$

And the dc-constannts $$c$$:

$$c = {1 \over T}{\sum\limits_{k=0}^{15} f(k \Delta T) \times \Delta T}\\$$

The calculations for the dc-constants

$$\begin{tabular}{|c|c|c|} \hline k & f(kDT) & c\\ \hline 0 & 7.5 & 0.94 \\ \hline 1 & 7.32 & 0.92\\ \hline 2 & 5.27 & 0.66\\ \hline 3 & 4.04 & 0.51\\ \hline 4 & 4.7 & 0.59\\ \hline 5 & 5.5 & 0.69\\ \hline 6 & 4.27 & 0.53\\ \hline 7 & 1.38 & 0.17\\ \hline 8 & -0.5 & -0.06\\ \hline 9 & 0.39 & 0.05\\ \hline 10 & 2.73 & 0.34\\ \hline 11 & 3.66 & 0.46\\ \hline 12 & 2.3 & 0.29\\ \hline 13 & 0.79 & 0.10\\ \hline 14 & 1.73 & 0.22\\ \hline 15 & 4.91 & 0.61\\ \hline & & 3.5\\ \hline \end{tabular}$$

Fig. 1.8

Substituting the value of coefficients $$a,b$$ and $$c$$ into equation 1.2 we can define the underline Fourier Series as follows, and by ploting the discrete time value at the $$\Delta T$$ interval we see that the sum of the series matches the data as shown in Fig. 1.9.

$$\\ f(t) = {3.5 + 1.5 sin(\omega t) + 0.5 sin(2 \omega t) + 0.3 sin(3 \omega t) + 2 cos (\omega t) + 2 cos(3 \omega t)}; \cdots \cdots 1.2 \\$$

The question is, are these the only frequencies in the system? obviously not, there are many more wavefunctions that would fit the data pattern, the proof is in Fig. 1.10, we doubled the data set that brought out more frequencies, the waveform is different but at the precise time $$k \Delta T$$ the function fits the data set. In between $$\Delta T$$ this is just a probability.

In order to be more precise we need more data to reduce $$\Delta T$$; hence, adding more high frequencies. How many more data in the data set? theoritically, up until $$\Delta T$$ approaches limit, only then, all possible high frequencies would be included, and that requires infinite samples in the data set. Anothrer factor is the period $$T$$, as we increase $$T$$ we incorporate more low frequencies into our system, in order to include all possible low frequencies our period should be infinite. This only shows that there is an inherent uncertainty when we use Fourier Series to evaluate a function.

Fig 1.9

Fig. 1.10

The Fouries series gave us the ability to define a function in time (sampled at interval $$\Delta T$$) with a set of sinusoidal waves as function of time. But, with a caveat that the data set should be periodic in nature. What if we the data set is a snapshot and we don't know if it is periodic, the mathematics should be modified to to remove the periodic dependency and that is the topic of discussion for Fourier Transform.

Before we proceed, let's recap what we have learned so far:

• An arbitrary waveform can be described as a sum of series of sinusoidal waves and a dc-constant.
• The fundamental frequency of the sinusoide would be equal to the frequency of the arbitrary waveform and all other frequencies would be integer multiple of the fundamental frequency.
• The total number of freqencies would be infinite for a continuous time function and for discrete time we only need frequencies upto the Nyquist frequency (half of sample size).
• Using the orthogonal property of the sinusoidal functions, we can determine the amplitude of individual sin and cos functions.

Fig 1.11

$$\begin{tikzpicture}[domain=0:1] \begin{axis}[ xlabel = k\Delta T, ylabel = {f(k\Delta T)} ] % density of Normal distribution: \addplot [red, samples=360 ] {3.5 + 1.5* sin(x * 360) + 0.5 * sin(2*x * 360) + 0.3 * sin(3 * x * 360) + 2 * cos (x*360) + 2 * cos(3 * x* 360)}; \addplot [ycomb,thin,mark=*, blue,domain=0:1, samples=16 ] {3.5 + 1.5* sin(x * 360) + 0.5 * sin(2*x * 360) + 0.3 * sin(3 * x * 360) + 2 * cos (x*360) + 2 * cos(3 * x* 360)}; \node (T) at (100,0) {T}; \addplot [blue,domain=0:1, samples=16 ] {0}; % \draw (-0.1,0) -- (0.9,0) node[right] {x}; % \draw (0,-1.2) -- (0,8) node[above] {f(x)}; \draw (0,0) circle (3pt); \end{axis} \end{tikzpicture}$$

The continuous time Fourier series

$$\\ \\ f(t) = c+\sum\limits_{n=1}^{\infty} a_n sin(\omega_n t) + \sum\limits_{n=1}^{\infty} b_n cos(\omega_n t)\right) \hdots \hdots \hdots(1.1)\\ \\ \\ a_n=1/\pi \int\limits_{t=0}^{2\pi} f(t) sin(\omega_n t) dt \\ b_n=1/\pi \int\limits_{t=0}^{2\pi} f(t) cos(\omega_n t) dt \\ c={ 1\over {2\pi}}{\int\limits_{t=0}^{2\pi} f(t) dt}$$

The discrete time Fourier series

$$\\ \\ f(k\Delta T) = c + \sum\limits_{n=1}^N a_n sin(n2\pi k\Delta T/T) + \sum\limits_{n=1}^N b_n cos(n2\pi k\Delta T/T)\right) \hdots \hdots \hdots(1.2) \\ \\ a_n = {2\over T} { \sum\limits_{k=0}^{K-1} {f(k\Delta T) \times sin({n2\pi \over T} k\Delta T ) \times \Delta T}} \\ \\ b_n = {2\over T} {\sum\limits_{k=0}^{K-1} {f(k\Delta T) \times cos({n2\pi \over T} k\Delta T ) \times \Delta T}} \\ \\ c = {1\over {T}}{\sum\limits_{k=0}^{K-1} f(k\Delta T) \times \Delta T} \\ \\$$