# Connexions

You are here: Home » Content » Lab 4: Fourier Series and Its Applications

### Recently Viewed

This feature requires Javascript to be enabled.

# Lab 4: Fourier Series and Its Applications

In this lab, we examine the representation of periodic signals based on Fourier series. Periodic signals can be represented by a linear combination of an infinite sum of sine waves, as expressed by the trigonometric Fourier series representation.Periodic signals can also be represented by an infinite sum of harmonically related complex exponentials, as expressed by the exponential Fourier series representation. In this lab, we analyze both of these series representations. In particular, we focus on how to compute Fourier series coefficients numerically.

## Fourier Series Signal Decomposition and Reconstruction

This example helps one to gain an understanding of Fourier series decomposition and reconstruction for periodic signals. The first step involves estimating x(mΔt)x(mΔt) size 12{x $$mΔt$$ } {} which is a numerical approximation of the analog input signal. Though programming environments deploy discrete values internally, we can obtain a close analog approximation of a continuous-time signal by using a very small ΔtΔt size 12{Δt} {}. That is to say, for all practical purposes, when ΔtΔt size 12{Δt} {} is taken to be very small, we get the analog representation or simulation of the signal. In this example, create four input signals using the listed LabVIEW MathScript functions in Table 1.

 Waveform type LabVIEW MathScript function Square wave square(T), T denotes period Triangular wave sawtooth(T,Width), Width=0.5 Sawtooth wave sawtooth(T,Width), Width=0 Half wave rectified sine wave {sin(2∗pi∗f∗t)for0≤t

Use a switch structure to select different types of input waveforms. Set the switch parameter w as the input and connect it to an Enum Control(Controls Modern Ring & Enum Enum). Edit the Enum Control items to include all the waveform types.

Set Amplitude of input (A), Period of input (T) and Number of Fourier coefficients (N) as control parameters. Determine Fourier coefficients a0,ana0,an size 12{a rSub { size 8{0} } ,a rSub { size 8{n} } } {}and bnbn size 12{b rSub { size 8{n} } } {} and reconstruct the signal from its Fourier coefficients using equations provided in Chapter 4. Determine the error between the input and the reconstructed signal by simply taking the absolute values of x(t)xˆ(t)x(t)xˆ(t) size 12{x $$t$$ - { hat {x}} $$t$$ } {}via the LabVIEW MathScript function abs. Finally, determine the maximum and average errors by using the functions max and sum. Figure 1 shows the completed block diagram of the Fourier series signal decomposition and reconstruction system.

Display the input signal using a waveform graph. Before displaying the graph, configure it using the function Build Waveform(Functions Programming Waveforms Build Waveforms). Also display the Fourier coefficients, reconstructed signal and error in the waveform graph, and place several numerical indicators to show the values of the Fourier coefficients, maximum error and average error.

Figure 2 and Figure 3 illustrate the front panel of the Fourier series signal decomposition and reconstruction system, respectively. To display all the outputs within a limited screen area, use a Tab Control(Controls Modern Containers Tab Control) in the front panel. Here the outputs are arranged in two different tabs: Fourier Series and Signal Reconstruction.

## Linear Circuit Analysis Using Trigonometric Fourier Series

In this example, let us perform electrical circuit analysis using the trigonometric Fourier series. The ability to decompose any periodic signal into a number of sine waves makes the Fourier series a powerful tool in electrical circuit analysis. The response of a circuit component when a sinusoidal input is applied to its terminals is well-known in circuit analysis. Thus, to obtain the response to any periodic signal, one can decompose the signal into sine waves and perform a linear superposition of the sine waves.

Consider a simple RC circuit excited by a periodic input signal as shown in Figure 4.

The block diagram of this linear circuit or system is shown in Figure 5. Determine the Fourier series coefficients of the input voltage signal as discussed in the previous example. Because the Fourier series involves the sum of sinusoids, phasor analysis can be used to obtain the output voltage (vc)(vc) size 12{ $$v rSub { size 8{c} }$$ } {}. Let nn size 12{n} {} represent the number of terms in the Fourier series. By using the voltage divider rule, the output voltage (vc)(vc) size 12{ $$v rSub { size 8{c} }$$ } {} can be expressed as (Reference),

vcn=1/(jnωC)R+1/(jnωC)vinnvcn=1/(jnωC)R+1/(jnωC)vinn size 12{v rSub { size 8{c_n} } = { {1/ $$ital "jn"ωC$$ } over {R+1/ $$ital "jn"ωC$$ } } v rSub { size 8{ ital "in"_n} } } {}
(1)

Because the sine and cosine components of the input voltage are known, one can easily determine the output by adding the individual output components because the circuit is linear. Determine each output voltage component by using Equation 1.

Figure 6 and Figure 7 show the front panel of this system for its two tabs. The magnitude and phase of the sine and cosine components are shown in the front panel separately. Furthermore, the tab control is used to show the Fourier series and system output separately.

## Lab Exercises

### Exercise 1

RL Circuit Analysis

Build a hybrid VI to analyze the RL circuit shown in Figure 8 using Fourier series.

The input voltage for the circuit is to be either a square wave or a triangular wave with a period T=2 seconds.

Compute and display the following:

1. The Fourier series coefficients of the input voltage v(t)v(t) size 12{v $$t$$ } {},
2. the current i(t)i(t) size 12{i $$t$$ } {},
3. the RMS (root mean square) value of v(t)v(t) size 12{v $$t$$ } {} using (i) the original waveform and (ii) its Fourier series coefficients (compare the outcomes),
4. the average power PavPav size 12{P rSub { size 8{ ital "av"} } } {}delivered by the source.

Hints:

RMS Value

The RMS value of a periodic function v(t)v(t) size 12{v $$t$$ } {}with period TT size 12{T} {}is given by

VRMS=1TTv2dtVRMS=1TTv2dt size 12{V rSub { size 8{ ital "RMS"} } = sqrt { { {1} over {T} } Int cSub { size 8{T} } {v rSup { size 8{2} } ital "dt"} } } {}
(2)

The RMS value of a waveform consisting of sinusoids with different frequencies is equal to the square root of the sum of the squares of the RMS value of each sinusoid. If a waveform is represented by the following Fourier series

v(t)=V0+V1sin(ω1t±φ1)+V2sin(ω2t±φ2)+...+VNsin(ωNt±φN)v(t)=V0+V1sin(ω1t±φ1)+V2sin(ω2t±φ2)+...+VNsin(ωNt±φN) size 12{v $$t$$ =V rSub { size 8{0} } +V rSub { size 8{1} } "sin" $$ω rSub { size 8{1} } t +- φ rSub { size 8{1} }$$ +V rSub { size 8{2} } "sin" $$ω rSub { size 8{2} } t +- φ rSub { size 8{2} }$$ + "." "." "." +V rSub { size 8{N} } "sin" $$ω rSub { size 8{N} } t +- φ rSub { size 8{N} }$$ } {}
(3)

then, the RMS value VRMSVRMS size 12{V rSub { size 8{ ital "RMS"} } } {}is given by

VRMS=V02+V122+V222+...+VN22VRMS=V02+V122+V222+...+VN22 size 12{V rSub { size 8{ ital "RMS"} } = sqrt {V rSub { size 8{0} rSup { size 8{2} } } + left ( { {V rSub { size 8{1} } } over { sqrt {2} } } right ) rSup { size 8{2} } + left ( { {V rSub { size 8{2} } } over { sqrt {2} } } right ) rSup { size 8{2} } + "." "." "." + left ( { {V rSub { size 8{N} } } over { sqrt {2} } } right ) rSup { size 8{2} } } } {}
(4)

Average power

The average power of the Fourier series can be expressed as

Pav=V0I0+V1RMSI1RMScosφ1+V2RMSI2RMScosφ2+...Pav=V0I0+V1RMSI1RMScosφ1+V2RMSI2RMScosφ2+... size 12{P rSub { size 8{ ital "av"} } =V rSub { size 8{0} } I rSub { size 8{0} } +V rSub { size 8{1 ital "RMS"} } I rSub { size 8{1 ital "RMS"} } "cos"φ rSub { size 8{1} } +V rSub { size 8{2 ital "RMS"} } I rSub { size 8{2 ital "RMS"} } "cos"φ rSub { size 8{2} } + "." "." "." } {}
(5)

#### Solution

Insert Solution Text Here

### Exercise 2

Doppler Effect

The Doppler effect denotes the change in frequency and wavelength of a wave as perceived by an observer moving relative to the wave source. The Doppler effect can be demonstrated via time scaling of Fourier series. The observer hears the siren of an approaching emergency vehicle with different amplitudes and frequencies as compared to the original signal. As the vehicle passes by, the observer hears another amplitude and frequency. The reason for the amplitude change (increased loudness) is because of the proximity of the vehicle. The closer it is, the louder it gets. The reason for frequency (pitch) change is due to the Doppler effect. As the vehicle approaches, each successive compression of the air caused by the siren occurs a little closer than the last one, and the opposite happens when the vehicle passes by. The result is the scaling of the original signal in the time domain, which changes its frequency. When the vehicle approaches, the scaling factor is greater than 1, resulting in a higher frequency, and, when it passes by, the scaling factor is less than 1, resulting in a lower frequency. More theoretical aspects of this phenomenon are covered in reference (Reference).

Define the original siren signal as x(t)x(t) size 12{x $$t$$ } {}. When the vehicle approaches, one can describe the signal by

x1(t)=B1(t)x(at)x1(t)=B1(t)x(at) size 12{x rSub { size 8{1} } $$t$$ =B rSub { size 8{1} } $$t$$ x $$ital "at"$$ } {}
(6)

where B1(t)B1(t) size 12{B rSub { size 8{1} } $$t$$ } {}is an increasing function of time (assuming a linear increment with time) and aa size 12{a} {}is the scaling factor having a value greater than 1. When the vehicle passes by, one can describe the signal by

x2(t)=B2(t)x(bt)x2(t)=B2(t)x(bt) size 12{x rSub { size 8{2} } $$t$$ =B rSub { size 8{2} } $$t$$ x $$ital "bt"$$ } {}
(7)

where B2(t)B2(t) size 12{B rSub { size 8{2} } $$t$$ } {}is a decreasing function of time (assuming a linear decrement with time) and bb size 12{b} {}is the scaling factor having a value less than 1.

First, generate a signal and create an upscale and a downscale version of it. Observe the Fourier series for all the signals. Set the amplitude and frequency of the original signal and the scaling factors as controls. In addition, play the sounds using the LabVIEW Play Waveform function. Figure 9 shows a possible front panel for this type of system.

#### Solution

Insert Solution Text Here

### Exercise 3

Synthesis of Electronic Music

In electronic music instruments, sound generation is implemented via synthesis. Different types of synthesis techniques such as additive synthesis, subtractive synthesis and frequency modulation (FM) synthesis are used to create audio waveforms. The simplest type of synthesis is additive synthesis, where a composite waveform is created by summing sine wave components, which is basically the inverse Fourier series operation. However, in practice, to create a music sound with rich harmonics requires adding a large number of sine waves, which makes the approach inefficient computationally. To avoid adding a large number of sine waves, modulation with addition is used. This exercise involves the design of algorithms used in the Yamaha DX7 music synthesizer, which debuted in 1983 as the first commercially available digital synthesizer.

The primary functional circuit in DX7 consists of a digital sine wave oscillator plus a digital envelope generator. Let us use additive synthesis and frequency modulation to achieve synthesis with six configurable operators. When one adds together the output of some operators, an additive synthesis occurs, and when one connects the output of one operator to the input of another operator, a modulation occurs.

In terms of block diagrams, the additive synthesis of a waveform with four operators is illustrated in Figure 10.

The output for the combination shown in Figure 10 can be written as

y(t)=A1sin(ω1t)+A2sin(ω2t)+A3sin(ω3t)+A4sin(ω4t)y(t)=A1sin(ω1t)+A2sin(ω2t)+A3sin(ω3t)+A4sin(ω4t) size 12{y $$t$$ =A rSub { size 8{1} } "sin" $$ω rSub { size 8{1} } t$$ +A rSub { size 8{2} } "sin" $$ω rSub { size 8{2} } t$$ +A rSub { size 8{3} } "sin" $$ω rSub { size 8{3} } t$$ +A rSub { size 8{4} } "sin" $$ω rSub { size 8{4} } t$$ } {}
(8)

Figure 11 shows the FM synthesis of a waveform with two operators.

The output for the combination shown in this figure can be written as

y(t)=A1sinω1t+A2sin(ω2t)y(t)=A1sinω1t+A2sin(ω2t) size 12{y $$t$$ =A rSub { size 8{1} } "sin" left (ω rSub { size 8{1} } t+A rSub { size 8{2} } "sin" $$ω rSub { size 8{2} } t$$ right )} {}
(9)

Other than addition and frequency modulation, one can use feedback or self-modulation in DX7, which involves wrapping back and using the output of an operator to modulate the input of the same operator as shown in Figure 12.

The corresponding equation is

y(t)=A1sinω1t+y(t)y(t)=A1sinω1t+y(t) size 12{y $$t$$ =A rSub { size 8{1} } "sin" left (ω rSub { size 8{1} } t+y $$t$$ right )} {}
(10)

Different arrangements of operators create different algorithms. Figure 13 displays the diagram of an algorithm.

And the output for this algorithm can be written as

y(t)=A1sinω1t+A2sin(ω2t)+A3sinω3t+A4sinω4t+A5sinω5t+y6(t)y(t)=A1sinω1t+A2sin(ω2t)+A3sinω3t+A4sinω4t+A5sinω5t+y6(t) size 12{y $$t$$ =A rSub { size 8{1} } "sin" left (ω rSub { size 8{1} } t+A rSub { size 8{2} } "sin" $$ω rSub { size 8{2} } t$$ right )+A rSub { size 8{3} } "sin" left (ω rSub { size 8{3} } t+A rSub { size 8{4} } "sin" left (ω rSub { size 8{4} } t+A rSub { size 8{5} } "sin" left (ω rSub { size 8{5} } t+y rSub { size 8{6} } $$t$$ right ) right ) right )} {}
(11)

With DX7, one can choose from 32 different algorithms. As one moves from algorithm No. 32 to algorithm No. 1, the harmonics complexity increases. In algorithm No. 32, all six operators are combined using additive synthesis with a self modulator generating the smallest number of harmonics. Figure 14 shows the diagram for all 32 combinations of operators. More details on music synthesis and the Yamaha DX7 synthesizer can be found in the (Reference)-(Reference).

Next, explore designing a system with six operators and set their amplitude and frequency as controls. By combining these operators, construct any three algorithms, one from the lower side (for example, algorithm No. 3), one from the middle side (for example, algorithm No. 17) and the final one from the upper side (for example, algorithm No. 30). Observe the output waves in the time and frequency domains (find the corresponding Fourier series).

#### Solution

Insert Solution Text Here

## Content actions

PDF | EPUB (?)

### What is an EPUB file?

EPUB is an electronic book format that can be read on a variety of mobile devices.

My Favorites (?)

'My Favorites' is a special kind of lens which you can use to bookmark modules and collections. 'My Favorites' can only be seen by you, and collections saved in 'My Favorites' can remember the last module you were on. You need an account to use 'My Favorites'.

| A lens I own (?)

#### Definition of a lens

##### Lenses

A lens is a custom view of the content in the repository. You can think of it as a fancy kind of list that will let you see content through the eyes of organizations and people you trust.

##### What is in a lens?

Lens makers point to materials (modules and collections), creating a guide that includes their own comments and descriptive tags about the content.

##### Who can create a lens?

Any individual member, a community, or a respected organization.

##### What are tags?

Tags are descriptors added by lens makers to help label content, attaching a vocabulary that is meaningful in the context of the lens.

| External bookmarks