# Fourier Series Examples

This document derives the Fourier Series coefficients for several functions. The functions shown here are fairly simple, but the concepts extend to more complex functions.

Consider the periodic pulse function shown below. It is an even function with period T. The function is a pulse function with amplitude A, and pulse width Tp. The function can be defined over one period (centered around the origin) as:

$$x_T(t) = \left\{ {\matrix{ The periodic pulse function can be represented in functional form as ΠT(t/Tp). During one period (centered around the origin)$$\Pi_T(t) = \left\{ {\matrix{

ΠT(t) represents a periodic function with period T and pulse width ½. The pulse is scaled in time by Tp in the function ΠT(t/Tp) so:

$${\Pi _T}\left( {{t \over {{T_p}}}} \right) = \left\{ {\matrix{ This can be a bit hard to understand at first, but consider the sine function. The function sin(x/2) twice as slow as sin(x) (i.e., each oscillation is twice as wide). In the same way ΠT(t/2) is twice as wide (i.e., slow) as ΠT(t). The Fourier Series representation is$${x_T}(t) = {a_0} + \sum\limits_{n = 1}^\infty {\left( {{a_n}\cos \left( {n{\omega _0}t} \right) + {b_n}\sin \left( {n{\omega _0}t} \right)} \right)} $$Since the function is even there are only an terms.$${x_T}(t) = {a_0} + \sum\limits_{n = 1}^\infty {{a_n}\cos \left( {n{\omega _0}t} \right)} = \sum\limits_{n = 0}^\infty {{a_n}\cos \left( {n{\omega _0}t} \right)} $$The average is easily found,$$a_0=A\frac{T_p}T$$The other terms follow from$${a_n} = {2 \over T}\int\limits_T {{x_T}\left( t \right)\cos \left( {n{\omega _0}t} \right)dt} ,\quad n \ne 0$$Any interval of one period is allowed but the interval from -T/2 to T/2 is straightforward in this case.$${a_n} = {2 \over T}\int\limits_{{-{T} \over 2}}^{{T \over 2}} {{x_T}\left( t \right)\cos \left( {n{\omega _0}t} \right)dt} $$Since xT(t)=A between -Tp/2 to +Tp/2 and zero elsewhere the integral simplifies and can be solved$$\begin{align}

Since sine is an odd function, sin(a)-sin(-a)=2sin(a), and using the fact that ω0=2π/T and

$${a_n} = {4 \over T}{A \over {n{\omega _0}}}\sin \left( {n{\omega _0}{{{t_p}} \over 2}} \right) = 4{A \over {n2\pi }}\sin \left( {n\pi {{{t_p}} \over T}} \right) = 2{A \over {n\pi }}\sin \left( {n\pi {{{t_p}} \over T}} \right)$$

This result is further explored in two examples.

Consider the case when the duty cycle is 50% (this means that the function is high 50% of the time, or Tp=T/2), A=1, and T=2. In this case a0=average=0.5 and for n≠0:

$$\displaylines{ The values for an are given in the table below. Note: this example was used on the page introducing the Fourier Series. Note also, that in this case an (except for n=0) is zero for even n, and decreases as 1/n as n increases.  n an 0 0.5 1 0.6366 2 0 3 -0.2122 4 0 5 0.1273 6 0 7 -0.0909 Average + 1st harmonic up to 3rd harmonic …5th harmonic …7th …21st The graph shows the function xT(t) (blue) and the partial Fourier Sum (from n=0 to n=N) (red)$$\sum\limits_{n = 0}^N {{a_n}\cos ({\omega _0}t)} $$as well as the highest frequency harmonic, a_Ncos(N\omega_0t) (dotted magenta). Lower frequency harmonics in the summation are thin dotted blue lines (but harmonics with a_n0 are not shown. You can change n by clicking the buttons. As before, note: Now consider the case when the duty cycle is 40%, A=1, and T=2. In this case a0=average=0.4 and for n≠0:$${a_n} = {4 \over T}{A \over {n{\omega _0}}}\sin \left( {n{\omega _0}{{{t_p}} \over 2}} \right) = 2{A \over {n\pi }}\sin \left( {0.4n\pi } \right)$$The values for an are given in the table below (note: this example was used on the previous page).  n an 0 0.4 1 0.6055 2 0.1871 3 -0.1247 4 -0.1514 5 -0.0000 6 0.1009 7 0.0535 Average + 1st harmonic up to 2nd harmonic …3rd harmonic …4th …21st The graph shows the function xT(t) (blue) and the partial Fourier Sum (from n=0 to n=N) (red)$$\sum\limits_{n = 0}^N {{a_n}\cos ({\omega _0}t)} $$Note that because this example is similar to the previous one, the coefficients are similar, but they are no longer equal to zero for n even. In problems with even and odd functions, we can exploit the inherent symmetry to simplify the integral. We will exploit other symmetries later. Consider the problem above. We have an expression for an, n≠0$${a_n} = {2 \over T}\int\limits_{ – {T \over 2}}^{{T \over 2}} {{x_T}\left( t \right)\cos \left( {n{\omega _0}t} \right)dt} $$If xT(t) is even, then the product xT(t)·cos(n·ω0t) is even (the product of two even functions is even). We can then use the fact that for an even function, e(t),$$\int\limits_{ – a}^{ + a} {e(t)dt} = 2\int\limits_0^a {e(t)dt} $$so$${a_n} = {4 \over T}\int\limits_0^{{T \over 2}} {{x_T}\left( t \right)\cos \left( {n{\omega _0}t} \right)dt} $$which generates the same answer as before. This will often be simpler to evaluate than the original integral because one of the limits of integration is zero. Consider, again, the pulse function. We can also represent xT(t) by the Exponential Fourier Series$${x_T}(t) = \sum\limits_{n = – \infty }^\infty {{c_n}} {e^{jn{\omega _0}t}}$$We find the cn$${c_n} = \int\limits_T {{x_T}(t){e^{ – jn{\omega _0}t}}dt} $$As before the integral is from -T/2 to +T/2 and make use of the facts that the function is constant for |t|<Tp/2 and zero elsewhere, and the T·ω0=2*·π.$$\begin{align}

Euler’s identities dictate that e+jθ-e-jθ=2jsin(θ) so e-jθ-e+jθ=-2jsin(θ).

and $${c_n} = {{ – 2jA} \over { – j2\pi n}}\sin \left( {n{\omega _0}{{{T_p}} \over 2}} \right) = {A \over {\pi n}}\sin \left( {n{\omega _0}{{{T_p}} \over 2}} \right)$$

Note that, as expected, c0=a0 and cn=an/2, (n≠0) (since this is an even function bn=0).

Consider the triangle wave

The average value (i.e., the 0th Fourier Series Coefficients) is a0=0. For n>0 other coefficients the even symmetry of the function is exploited to give

$${a_n} = {2 \over T}\int\limits_T {{x_T}\left( t \right)\cos \left( {n{\omega _0}t} \right)dt} = {2 \over T}\int\limits_{ – {T \over 2}}^{ + {T \over 2}} {{x_T}\left( t \right)\cos \left( {n{\omega _0}t} \right)dt} = {4 \over T}\int\limits_0^{ + {T \over 2}} {{x_T}\left( t \right)\cos \left( {n{\omega _0}t} \right)dt}$$

Between t=0 and t=T/2 the function is defined by xT(t)=A-4At/T so

$${a_n} = {4 \over T}\int\limits_0^{ + {T \over 2}} {\left( {A – {{4A} \over T}t} \right)\cos \left( {n{\omega _0}t} \right)dt} = {{4A} \over T}\left( {\int\limits_0^{ + {T \over 2}} {\cos \left( {n{\omega _0}t} \right)dt} – {4 \over T}\int\limits_0^{ + {T \over 2}} {t\cos \left( {n{\omega _0}t} \right)dt} } \right)$$

Perform the integrations (either by hand using integration by parts, or with a table of integrals, or by computer) and use the fact that ω0·T=2·π

$${a_n} = {{4A} \over T}\left( {{{T\sin (\pi n)} \over {2\pi n}} + {4 \over T}{{{T^2}{\mkern 1mu} \left( {2{\mkern 1mu} \sin {{\left( {{{\pi {\mkern 1mu} n} \over 2}} \right)}^2} – \pi {\mkern 1mu} n{\mkern 1mu} \sin \left( {\pi {\mkern 1mu} n} \right)} \right)} \over {4{\mkern 1mu} {\pi ^2}{\mkern 1mu} {n^2}}}} \right)$$

Since sin(π·n)=0 this simplifies to

$${a_n} = {{4A} \over T}{4 \over T}{{{T^2}{\mkern 1mu} 2{\mkern 1mu} \sin {{\left( {{{\pi {\mkern 1mu} n} \over 2}} \right)}^2}} \over {4{\mkern 1mu} {\pi ^2}{\mkern 1mu} {n^2}}} = {{8A\sin {{\left( {{{\pi {\mkern 1mu} n} \over 2}} \right)}^2}} \over {{\pi ^2}{\mkern 1mu} {n^2}}}$$

This answer is correct, but noting that

$$n = 0,1,2,3,4,5,6,7,…\quad \quad \sin {\left( {{{\pi {\mkern 1mu} n} \over 2}} \right)^2} = 0,1,0,1,0,1,0,… = {{{ 1 -{\left( { – 1} \right)}^n}} \over 2}$$

yields an even simpler result

$${a_n} = \left\{ {\matrix{ If xT(t) is a triangle wave with A=1, the values for an are given in the table below (note: this example was used on the previous page).  n an 0 0 1 0.8106 2 0 3 0.0901 4 0 5 0.0324 6 0 7 0.0165 Average + 1st harmonic up to 3rd harmonic …5th harmonic …7th …9th Note: this is similar, but not identical, to the triangle wave seen earlier. Note: Thus far, the functions considered have all been even. The diagram below shows an odd function. In this case, a Fourier Sine Series is appropriate$${x_T}(t) = \sum\limits_{n = 1}^\infty {{b_n}\sin \left( {n{\omega _0}t} \right)} \quad \quad {b_n} = {2 \over T}\int\limits_T {{x_T}\left( t \right)\sin \left( {n{\omega _0}t} \right)dt} $$It is easiest to integrate from -T/2 to +T/2. Over this interval x_T(t)=2At/T.$${b_n} = {2 \over T}\int\limits_{ – {T \over 2}}^{ + {T \over 2}} {{x_T}\left( t \right)\sin \left( {n{\omega _0}t} \right)dt} = {2 \over T}\int\limits_{ – {T \over 2}}^{ + {T \over 2}} {{{2At} \over T}\sin \left( {n{\omega _0}t} \right)dt} $$Performing the integration (and using the fact that ω0·T=2·π) the integral yields$${b_n} = {2 \over T}{{A{\mkern 1mu} T{\mkern 1mu} \left( {\sin \left( {\pi {\mkern 1mu} n} \right) – \pi {\mkern 1mu} n{\mkern 1mu} \cos \left( {\pi {\mkern 1mu} n} \right)} \right)} \over {{\pi ^2}{\mkern 1mu} {n^2}}}$$Using two simplification, sin(π·n)=0 and cos(π·n)=(-1)n gives$${b_n} = – {{2A{\mkern 1mu} } \over {\pi n}}{\left( { – 1} \right)^n}$$In this case since xT(t) is odd and is multiplied by another odd function (sin(n·ω0t)), their product is even and the integral can be rewritten as:$${b_n} = {2 \over T}\int\limits_{ – {T \over 2}}^{ + {T \over 2}} {{x_T}\left( t \right)\sin \left( {n{\omega _0}t} \right)dt} = {b_n} = {4 \over T}\int\limits_0^{ + {T \over 2}} {{x_T}\left( t \right)\sin \left( {n{\omega _0}t} \right)dt} $$If xT(t) is a sawtooth wave with A=1, the values for bn are given in the table below  n bn 1 0.6366 2 -0.3183 3 0.2122 4 -0.1592 5 0.1273 6 -0.1061 7 0.0909 Average + 1st harmonic up to 2nd harmonic …3rd …4th …5th …20th Note: this is similar, but not identical, to the sawtooth wave seen earlier. Note: So far, all of the functions considered have been either even or odd, but most functions are neither. This presents no conceptual difficult, but may require more integrations. For example if the function xT(t) looks like the one below Since this has no obvious symmetries, a simple Sine or Cosine Series does not suffice. For the Trigonometric Fourier Series, this requires three integrals$$\begin{align}

However, an exponential series requires only a single integral

$$\displaylines{ For this reason, among others, the Exponential Fourier Series is often easier to work with, though it lacks the straightforward visualization afforded by the Trigonometric Fourier Series. In this case, but not in general, we can easily find the Fourier Series coefficients by realizing that this function is just the sum of the square wave (with 50% duty cycle) and the sawtooth so  n an bn 0 0.5 —- 1 0.6366 0.6366 2 0 -0.3183 3 -0.2122 0.2122 4 0 -0.1592 5 0.1273 0.1273 6 0 -0.1061 7 -0.0909 0.0909 From the relationship between the Trigonometric and Exponential Fourier Series$$c_0=a_0 \ and \ c_n = \frac{a_n}2 – j\frac{b_n}2 for n \neq 0, \quad with \ c_{-n}=c_n^*$$ n cn -7 -0.0455 + 0.0455j -6 -0.0531j -5 0.0637 + 0.0637j -4 -0.0796j -3 -0.1061 + 0.1061j -2 -0.1592j -1 0.3183 + 0.3183j 0 0.5 1 0.3183 – 0.3183j 2 0.1592j 3 -0.1061 – 0.1061j 4 0.0796j 5 0.0637 – 0.0637j 6 0.0531j 7 -0.0455 – 0.0455j Average + 1st harmonic up to 2nd harmonic …3rd …4th …5th …20th Note: this is similar, but not identical, to the sawtooth wave seen earlier. Note: If the function xT(t) has certain symmetries, we can simplify the calculation of the coefficients.  Symmetry Simplification xT(t) is even$$\displaylines{ {a_0} = average \cr {a_n} = {4 \over T}\int\limits_0^{ + {T \over 2}} {{x_T}(t)\cos \left( {n{\omega _0}t} \right)dt} , \quad n \neq 0 \cr {b_n} = 0 \cr} $$xT(t) is odd$$\displaylines{ {a_n} = 0 \cr {b_n} = {4 \over T}\int\limits_0^{ + {T \over 2}} {{x_T}(t)\sin \left( {n{\omega _0}t} \right)dt} \cr} $$xT(t) has half-wave symmetry A periodic function has half wave symmetry if f(t-T/2)=-f(t). In other words, if you shift the function by half of a period, then the resulting function is the opposite the original function. The triangle wave has half-wave symmetry. See below for clarification. A function can have half-wave symmetry without being either even or odd.$$\displaylines{ {a_n} = {b_n} = 0,\quad n\;even \cr {a_n} = {4 \over T}\int\limits_0^{ + {T \over 2}} {{x_T}(t)\cos \left( {n{\omega _0}t} \right)dt} ,\quad n\;odd \cr {b_n} = {4 \over T}\int\limits_0^{ + {T \over 2}} {{x_T}(t)\sin \left( {n{\omega _0}t} \right)dt} ,\quad n\;odd \cr} $$The first two symmetries are were discussed previously in the discussions of the pulse function (xT(t) is even) and the sawtooth wave (xT(t) is odd). Half-wave symmetry is depicted the diagram below. The top function, xT1(t), is odd (xT1(t)=-xT1(-t)), but does not have half-wave symmetry. The bottom function, xT2(t) is nether even nor odd, but since xT2(t)=-xT2(t-T/2), it has halfwave symmetry. To visualize this imagine shifting the function by half a period (T/2); for half-wave symmetry the shifted function should be the mirror image of the original function (about the horizontal axis) as shown below The reason the coefficients of the even harmonics are zero can be understood in the context of the diagram below. The top graph shows a function, xT(t) with half-wave symmetry along with the first four harmonics of the Fourier Series (only sines are needed because xT(t) is odd). The bottom graph shows the harmonics multiplied by xT(t). Now imagine integrating the product terms from -T/2 to +T/2. The odd terms (from the 1st (red) and 3rd (magenta) harmonics) will have a positive result (because they are above zero more than they are below zero). The even terms (green and cyan) will integrate to zero (because they are equally above and below zero). Though this is a simple example, the concept applies for more complicated functions, and for higher harmonics. The only function discussed with half-wave symmetry was the triangle wave and indeed the coefficients with even indices are equal to zero (as are all of the bn terms because of the even symmetry). The square wave with 50% duty cycle would have half wave symmetry if it were centered around zero (i.e., centered on the horizontal axis). In that case the a0 term would be zero and we have already shown that all the terms with even indices are zero, as expected. Simplifications can also be made based on quarter-wave symmetry, but these are not discussed here. A periodic function has quarter wave symmetry if it has half wave symmetry and it is either even or odd around its two half-cycles. Since the coefficients cn of the Exponential Fourier Series are related to the Trigonometric Series by$$\displaylines{

(assuming xT(t) is real) we can use the symmetry properties of the Trigonometric Series to find an and bn and hence cn.

However, in addition, the coefficients of cn contain some symmetries of their own. In particular,

Let’s examine the Fourier Series representation of the periodic rectangular pulse function, ΠT(t/Tp), more carefully.

Since the function is even, we expect the coefficients of the Exponential Fourier Series to be real and even(from symmetry properties). Furthermore, we have already calculated the coefficients of the Trigonometric Series, and could easily calculate those of the Exponential Series. However, let us do it from first principles. The Exponential Fourier Series coefficients are given by

$$\displaylines{ {\Pi _t}\left( {{t \over {{T_p}}}} \right) = \sum\limits_{n = – \infty }^{ + \infty } {{c_n}{e^{jn{\omega _0}t}}} \cr with \cr {c_n} = {1 \over T}\int_T {{\Pi _t}\left( {{t \over {{T_p}}}} \right){e^{ – jn{\omega _0}t}}dt} \cr }$$

We can change the limits of integration to -Tp/2 and +Tp/2 (since the function is zero elsewhere) and proceed (the function is one in that interval, so we can drop it). We also make use of the fact the ω0=2π/T and Euler’s identity for sine.

\begin{align} {c_n} &= {1 \over T}\int\limits_{ – {T \over 2}}^{ + {T \over 2}} {{\Pi _t}\left( {{t \over {{T_p}}}} \right){e^{ – jn{\omega _0}t}}dt} = {1 \over T}\int\limits_{ – {{{T_p}} \over 2}}^{ + {{{T_p}} \over 2}} {{e^{ – jn{\omega _0}t}}dt} \cr The last step in the derivation is performed so we can use the sinc() function (pronounced like “sink”). This function comes up often in Fourier Analysis.{\mathop{\rm sinc}\nolimits} (x) = {{\sin \left( {\pi x} \right)} \over {\pi x}}$$Note: unfortunately there are two common definitions of the “sinc()” function. Engineers tend to use {\mathop{\rm sinc}\nolimits} (x) = {{\sin \left( {\pi x} \right)} \over {\pi x}}; this definition is used in MATLAB. Mathematicians tend to use {\mathop{\rm sinc}\nolimits} (x) = {{\sin \left( x \right)} \over x}; this definition is used in Mathematica. We will use the former definition. Using the “engineering” notation for “sinc()” the coefficients simplify to$${c_n} = {{{T_p}} \over T}{\mathop{\rm sinc}\nolimits} \left( {{{n{T_p}} \over T}} \right)

The sinc function has several important features:

The diagram below shows cn vs n for several values of the duty cycle, Tp/T.

Duty cycle = 0.1 …0.25 …0.5 …0.75 …0.9

The graph on the left shows the time domain function. If you hit the middle button, you will see a square wave with a duty cycle of 0.5 (i.e., it is high 50% of the time). The period of the square wave is T=2·π;. The graph on the right shown the values of cn vs n as red circles vs n (the lower of the two horizontal axes; ignore the top axis for now). The blue line goes through the horizontal axis whenever the argument of the sinc() function, n·Tp/T is an integer (except when n=0.). In particular the first crossing of the horizontal axis is given by n·Tp/T=1 or n=T/Tp (note this is not an integer values of Tp). There are several important features to note as Tp is varied.

References

You are watching: Fourier Series Examples. Info created by THVinhTuy selection and synthesis along with other related topics.

Rate this post