Fast Fourier Transform Report

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 19

PHYLAB2

FFT and Filtering


Karabo Letsholo, LTSKAR009
Katlego Motaung
April 2023

1
1 Introduction and Theory
In this section, we introduce the theory behind Fourier transform, the intuitive meaning behind it and essentially
its useful applications such as the fast Fourier transform in signal processing.

1.1 Fourier Transform


A Fourier Transform decomposes functions representing fluctuating phenomena† into sinusoids -undulating curves
oscillating between consecutive minima and maxima1 . The Fourier Transform describes the amplitude and phase
of each sinusoid which correspond to a specific frequency1 .

This means we can represent any fluctuating phenomena as a linear combination of sinusoids of different am-
plitude at different fundamental frequencies.
For this fact, the Fourier transform has vast applications in processes dealing with fluctuating phenomena such as
signal processing, astronomy, the heat equation , e.t.c.

1.2 Fourier Series


The Fourier series of any periodic function f (t) -that repeats after period T , is given by2 ,

X
f (t) = cn einωt
n=−∞

2
Where the coefficient functions cn are given by ,
Z T
1 2
cn = f (t)e−inωt dt
T − T2


Where, ω is the angular frequency given by T and T is the period.

2 Discrete and Fast Fourier Transform


”The discrete Fourier transform (DFT) is a transform in its own right such as the Fourier integral
transform or the Fourier series transform. It is a powerful reversible mapping operation for time series.
As the name implies, it has mathematical properties that are entirely analogous to those of the Fourier
integral transform. In particular, it defines a spectrum of a time series; multiplication of the transform
of two time series corresponds to convolving the time series3 ”
This means we can transform our frequency domain to our time domain by representing the fluctuating phenomena
with frequencies and amplitudes corresponding to the fundamental frequencies in the independent variable time
using the Fourier transform.

The Fast Fourier Transform is an efficient and economic way of computing the Discrete Fourier transform. The
Fast Fourier Transform takes advantage of the fact that the Discrete Fourier Transform is a iterative process.

3 Filters
Filtering can be used to reduce the noise in a specific signal or fluctuating phenomenon by filtering only specific
frequencies.

In general, we have a low-pass filter that filters frequencies below a certain frequency and outputs those frequencies
while ignoring the rest. A high-pass filter on the other hand, filters frequencies above a certain frequency and
outputs those frequencies while it ignores the rest of the frequencies below it. A band-pass filter filters a band of
frequencies within a specific range and outputs those frequencies, ignoring other unwanted frequencies.
Filtering is possible both a software or hardware level and the LRC circuit is an example of filtering at hardware
level.
† Fluctuating Phenomena may imply processes that involve a periodic change of Signals over time or may be Signals.

2
4 Aim
The aim of this experiment is to understand the underlying principle of the Fast Fourier Transform and how filters
work in signal processing.
We will explore filtering at a software level and look at how to decompose signals into their time series at different
fundamental frequencies and amplitudes using the method of the Fast Fourier Transform to convert our ”Frequency”
Domain (A interval of a periodic function that depends on the frequency) into the ”Time” Domain (An interval of
a periodic function that depends on time).

5 Apparatus
For this experiment, we were experimenting on different sources of signals and were trying to compute the Fast
Fourier Transform for the different signals.

In our case, we needed the myDAQ in order to use the software packages ”F T.exe” -which performs a Fast Fourier
Transform on the input signal, and ”Equi.exe” -which analyses signals and can tweak certain properties of the
signal.
We also needed the function generator to experiment with different electric signals -square,triangular,sine.
Lastly, we needed a microphone to analyze input sound signals from a music player or a tuning fork or any object
of interest that may produce a sound. This also required us to have earphones and an audio mp3 device.
We lastly needed the solar panel, a screwdriver and connecting wires for the configuration of each setup.

6 Method
This section outlines the method for our experiment as steps we undertook to execute this experiment.

6.1 Electrical Signals


In analyzing electrical signals, we connected the AI 0+ and 0- ports of the myDAQ to the function generator and
connected the myDAQ to a computer. On the computer, we opened the ”FT.exe” program.
We turned off the microphone toggle switch on the software.
We turned on the function generator and explored different signals at different frequencies.

6.1.1 Sinusoidal, Square and Triangular Signals


We first set the function generator to produce signals with frequencies on the spectrum 80 − 300 Hz. We then
turned on the function generator to produce a sinusoidal electric signal, then we looked a the original signal and
the its Fast Fourier Transform on two different set of axes in the ”FT.exe” program.
You may need to increase the number of sample points in the software to make the graphs appear smooth as it will
make the analysis easier. We next applied a low pass filter on our signal so that it filters frequencies below a certain
frequency and outputs those filtered frequencies. We applied filters at different frequencies, we observed the Fast
Fourier Transform of the filtered signal and the filtered signal itself.
We then collected the data from different frequencies and drove the circuit with different signals such as triangular
and square signals and repeated the experiment at using those different signals.

6.2 Sound Signals


For the analysis of input sound signals, we first connected the microphone to the audio input slot of the myDAQ
and connected the myDAQ to the computer.

6.2.1 Tuning Fork


On the computer, we turned on the microphone toggle switch. We then next use different tuning fork of different
frequencies to produce vibrations and observe them in the software plot, we looked at the original signals and
their Fast Fourier Transform, we then applied the low pass filter to different signals, we observed the Fast Fourier
Transform of the filtered signal and recorded the results.

3
6.2.2 mp3 Audio
For the mp3 audio signal processing part, we connected the audio input slot of the myDAQ to an mp3 audio player
using an aux cable, we then connected the audio output slot of the myDAQ to earphones.
We next opened the ”Equi.exe” program.
We play music and experimented with different tunes by adjusting parameters such as treble, base, volume and
mid-tone.
We observed how adjusting certain parameters with respect to other affect the sound playing.
Lastly, we recorded the measurements.

6.3 Solar Panel


For the analysis of signals from the DC signal of the solar panel, we first connected the output wires of the solar
panel to the AI 0+ and 0- ports of the myDAQ.
We then connected the myDAQ to a computer and opened the ”FT.exe” program on the computer. We had to
make sure that the microphone toggle switch was off.
We the measured the signal from the solar panel, we applied a low-pass filter on the signal and took observations
and measurements of the results.
We then covered the solar panel with our hand to give some partial shading for the photovoltaic cells, we then
observed the measurements and recorded the results.
We applied a low pass filter on the partially shaded photovoltaic unit and observed and recorded the results.

7 Data
This section includes the data collected from the experiments with no analysis in anyway, we have included the
fundamental frequencies and amplitudes of the Fast Fourier Transform from each measurement below.

7.1 Electrical Signals


In this section, we record the data from the experiment using the function generator in the following tables.

7.1.1 Sinusoidal electrical signals


This section includes data collected from experimenting with sinusoidal signals from the function generator, here
only one fundamental frequency appeared in the measurements, only the unfiltered signals are used.

Sinusoidal frequency 209.30 Hz


Fundamental FFT frequency [Hz] Amplitude [V]
210.00 3.54

Table 1: Data for the sinusoidal wave

7.1.2 Triangular Wave electrical signals


In this section, the data collected from experimenting with triangular electrical signals is recorded here, only the
unfiltered signals are used.

Triangular Frequency 100.60 Hz


Fundamental FFT frequency [Hz] Amplitude [V]
100.00 3.24
300.00 0.34
500.00 0.11
700.00 0.05
900.00 0.03

Table 2: Data for the Triangular Wave Signals

4
7.1.3 Square Wave electrical signals
In this section, we recorded the values of the fundamental frequencies and amplitude of the voltage corresponding
to each fundamental for each wave we experimented on.

Square Wave Frequency 141.90 Hz


Fundamental FFT frequency [Hz] Amplitude [V]
140.00 4.84
430.00 1.23
710.00 1.03
990.00 0.62
1280.00 0.50
1560.00 0.49
1840.00 0.30
2130.00 0.33
2410.00 0.31
2690.00 0.18
2980.00 0.25
3260 0.21

Table 3: Data for the Square Wave Signals

7.2 Sound Input Signals


In this section we record the measurement taken from the experiment on input sound signals. This is mainly the
raw data from experimenting with the tuning forks.

Tuning Fork 256 Hz frequency


Tuning Fork Dull frequency
Fundamental FFT frequency [Hz] Amplitude [V]
Fundamental FFT frequency [Hz] Amplitude [V]
50.00 10.79e-4
50.00 12.09e-4
100.00 2.03e-5
100.00 2.25e-5
200.00 1.13e-6
260.00 1.70e-5
460.00 1.40e-7
Tuning Fork 384 Hz
Tuning Fork 426.6 Hz
Fundamental FFT frequency [Hz] Amplitude [V]
Fundamental FFT frequency [Hz] Amplitude [V]
50.00 9.81e-5
50.00 8.88e-5
100.00 1.87e-5
100.00 1.53e-5
380.00 69.70e-4
430.00 28.29e-4
770.00 1.32e-6

Table 4: Tuning for data for the frequencies 256.00,384.00 and 426.60 Hz

7.3 Photovoltaic Panel


In this section, we recorded the data from the experiment with the solar panel in the following tables.

7.3.1 Solar Panel with Partial Shading


In this section, I will record the few measurements for the solar panel experiment with partial shading over the
panel.

5
Solar Panel With Partial Shade
Solar Panel With Partial Shade Fundamental FFT Frequency [Hz] Amplitude [V]
Fundamental FFT Frequency [Hz] Amplitude [V] 1.30e-3 10.19
0.00 10.24 1.40e-3 10.18
1.00e-4 10.24 1.50e-3 10.18
2.00e-4 10.24 1.60e-3 10.17
3.00e-4 10.24 1.70e-3 10.17
4.00e-4 10.24 1.80e-3 10.17
5.00e-4 10.24 1.90e-3 10.17
6.00e-4 10.24 2.00e-3 10.17
7.00e-4 10.24 2.10e-3 10.17
8.00e-4 10.23 2.20e-3 10.17
9.00e-4 10.22 2.30e-3 10.17
1.00e-3 10.21 2.40e-3 10.18
1.10e-3 10.21 2.50e-3 10.19
1.20e-3 10.20 2.60e-3 10.19
2.70e-3 10.20

Table 5: Tables for the data containing values for the frequency and voltage of the solar panel with partial shading
covering it.

7.3.2 Solar Panel With no Shading


This section records the data for the solar panel with no shading over the panel.

Solar Panel with no Shade


Fundamental FFT frequency [Hz] Amplitude [V]
0.00e-4 10.69
1.00e-4 10.69
2.00e-4 10.69
3.00e-4 10.69
4.00e-4 10.69
5.00e-4 10.69
6.00e-4 10.69
7.00e-4 10.69
8.00e-4 10.69
9.00e-4 10.69
1.00e-3 10.69
1.10e-3 10.69
1.20e-3 10.69

Table 6: Table for data for the solar panel with no shading covering it.

6
8 Graphs and best-fit line
In this section, I plot graphs for the best-fit line and the raw data.

8.1 Electrical Signals


This section plots graphs of the electrical signals here.

8.1.1 Square Wave Signal

Figure 1: FFT Data of the Square wave signal with frequency 141.90Hz plot

Figure 2: Plot for the Square FFT transformed data of frequency 141.90Hz

7
8.1.2 Triangular Wave Signal

Figure 3: Triangular Signal produced from FFT values of amplitude and frequency, 100.60Hz

Figure 4: FFT of triangular signal with frequency 100.60Hz

8
8.1.3 Sine Wave Signal

Figure 5: Signal generated from the FFT of a sinusoid of frequency of 209.30Hz

Figure 6: FFT of the sinusoidal wave signal of frequency 209.30Hz

9
8.2 Sound Signals
The followings are plots for the tuning fork data.

Figure 7: FFT for the turning fork with frequency 256Hz

Figure 8: Original retrieved from the FFT data

Figure 9: FFT of the 384.00Hz Tuning fork signal

Figure 10: Original signal of the FFT Tuning signal with 384.00Hz retrieved from the FFT

10
8.3 Solar Panel Signal

Figure 11: FFT plot of the non-shaded solar panel

Figure 12: Plot of the non-shaded panel with data retrieved from the FFT

Figure 13: FFT of the partially shaded solar panel signal

Figure 14: Signal of the partially shaded panel with data retrieved from the FFT of the signal

11
9 Calculations
In this section, I calculate the Fourier Transforms of the signals I have experimented in.

9.1 Electrical Signals


9.1.1 Triangular Wave Signal
We can now calculate the Fourier Transform for the triangular wave using the power spectrum in the table for the
triangular wave signal. This is done for the frequency of 100.60Hz.
n
X
f (t) = |P (ωi )| sin(ωi t)
i=0

3.24 0.34 0.11 0.05 0.03


f (t) = sin(100.00t) + sin(300.00t) + sin(500.00t) + sin(700.00t) + sin(900.00t) (1)
2.00 2.00 2.00 2.00 2.00

9.1.2 Square Wave Signal


In this subsection, we calculate the Fourier transform for the square wave signal of frequency 141.90 Hz using the
power spectrum.
From table 3, we find that,
4.84 1.23 1.03 0.62 0.50 0.49
f (t) = sin(140.00t) + sin(430.00t) + sin(710.00t) + sin(990.00t) + sin(1280.00t) + sin(1560.00t)
2.00 2.00 2.00 2.00 2.00 2.00
0.30 0.30 0.31 0.18 0.25 0.21
+ sin(1840.00t) + sin(2130.00t) + sin(2410.00t) + sin(2690.00t) + sin(2980.00t) + sin(3260.00t)
2.00 2.00 2.00 2.00 2.00 2.00

9.1.3 Sinusoidal Wave Signal


In this section we write the Fourier Transform of the sinusoidal wave signal using the power spectrum.

f (t) = 3.54 sin(210.00t)

9.2 Sound Signals


In this section, we will essentially perform the Fourier transform of the input sound signals table 4.

9.2.1 Tuning Fork frequency Dull


In this section, I perform a Fourier Transform of the dull tuning fork by using the power spectrum as the series
coefficients of the Fourier transform.

f (t) = 12.09 × 10−4 sin(50.00t) + 2.25 × 10−5 sin(100.00t) + 1.70 × 10−5 sin(260.00t)

9.2.2 Tuning Fork frequency 256.00 Hz


In this section, we find the Fourier transform of the tuning fork with frequency 265.00 Hz using its power spectrum.

f (t) = 10.79 × −4 sin(50.00t) + 2.03 × 10−5 sin(100.00t) + 1.13 × 10−6 sin(200.00t) + 1.40 × 10−7 sin(460.00t)

9.2.3 Tuning Fork frequency 384.00 Hz


In this section, I once more perform the Fourier expansion for the 384.00Hz tuning fork signal to find,

f (t) = 9.8 × 10−5 sin(50.00t) + 1.87 × 10−5 sin(100.00t) + 69.70 × 10−4 sin(380.00t) + 1.32 × 10−6 sin(770.00t)

9.2.4 Tuning Fork frequency 426.60 Hz


Lastly, I will perform the Fourier transform on the tuning fork of frequency 426.60 Hz.

f (t) = 8.88 × 10−5 sin(50.00t) + 1.53 × 10−5 sin(100.00t) + 28.29 × 10−4 sin(430.00t)

12
9.3 Solar Panel Signals
In this section, we perform Fourier transforms on signals from the solar panel.

9.3.1 Non-Shaded photovoltaic Panel


For the non-shaded panel, the power spectrum acquires the same amplitude through out the frequency domain.

X
f (t) = 10.69 sin(i × 10−4 )
i=0

9.3.2 Shaded Photovoltaic panel


For the shaded photo voltaic, the power spectrum varies across the frequency domain.
7
X 11
X
f (t) = 10.24 sin(i × 10−4 ) + 10.23 sin(8.00 × 10−4 ) + 10.22 sin(9.00 × 10−4 ) + 10.21 sin(i × 10−4 ) + . . .
i=0 i=10

10 Uncertainty Analysis
In this section, I evaluate the uncertain of the values of the power spectrum and frequency stored in the tables and
used in the Fourier series of the signals under investigation. All measurement was digital, meaning it carries equal
probability around the variance of a point, therefore we shall deploy the use of the flat pdf for our purposes. We
will
√ use type A uncertainty analysis. The uncertainty for the flat pdf is given by the width of the pdf a, divided by
3,
a
u= √ (2)
2 3

10.1 Electrical Signals


In this section, we look at the uncertainty in the Fourier coefficients and the frequencies.

10.1.1 Triangular Wave Signal


The uncertainty in each measurement of the amplitude is given below,
3.245 − 3.235
u3.24 = √ = 2.88 × 10−3
2 3
0.345 − 0.335
u0.34 = √ = 2.88 × 10−3
2 3
0.115 − 0.105
u0.11 = √ = 2.88 × 10−3
2 3
0.055 − 0.045
u0.05 = √ = 2.88 × 10−3
2 3
0.035 − 0.025
u0.03 = √ = 2.88 × 10−3
2 3
The Uncertainty in the measurement of the frequencies is given by,
100.005 − 99.995
u100.00 = √ = 2.88 × 10−3
2 3
300.005 − 299.995
u300.00 = √ = 2.88 × 10−3
2 3
500.005 − 499.995
u500.00 = √ = 2.88 × 10−3
2 3
700.005 − 699.995
u700.00 = √ = 2.88 × 10−3
2 3
900.005 − 899.995
u900.00 = √ = 2.88 × 10−3
2 3

13
10.1.2 Square Wave Signal
The uncertainty in the measurement of the amplitude of the power spectrum is,
4.845 − 4.835
u4.84 = √ = 2.88 × 10−3
2 3
1.235 − 1.225
u1.23 = √ = 2.88 × 10−3
2 3
1.035 − 1.025
u1.03 = √ = 2.88 × 10−3
2 3
0.625 − 0.615
u0.62 = √ = 2.88 × 10−3
2 3
0.505 − 0.495
u0.50 = √ = 2.88 × 10−3
2 3
0.495 − 0.485
u0.49 = √ = 2.88 × 10−3
2 3
0.305 − 0.295
u0.30 = √ = 2.88 × 10−3
2 3
0.305 − 0.295
u0.30 = √ = 2.88 × 10−3
2 3
0.315 − 0.305
u0.31 = √ = 2.88 × 10−3
2 3
0.185 − 0.175
u0.18 = √ = 2.88 × 10−3
2 3
0.225 − 0.215
u0.25 = √ = 2.88 × 10−3
2 3
0.215 − 0.205
u0.21 = √ = 2.88 × 10−3
2 3

14
And the associated standard uncertainty is given by,
140.005 − 139.995
u140.0 = √ = 2.88 × 10−3
2 3
430.005 − 429.995
u430.00 = √ = 2.88 × 10−3
2 3
710.005 − 709.995
u710.00 = √ = 2.88 × 10−3
2 3
990.005 − 989.995
u990.00 = √ = 2.88 × 10−3
2 3
1280.005 − 1199.995
u1280.00 = √ = 2.88 × 10−3
2 3
1560.005 − 1559.995
u1560.00 = √ = 2.88 × 10−3
2 3
1840.005 − 1839.995
u1840.00 = √ = 2.88 × 10−3
2 3
2130.005 − 2129.995
u2130.00 = √ = 2.88 × 10−3
2 3
2410.005 − 2409.995
u2410.00 = √ = 2.88 × 10−3
2 3
2690.005 − 2689.995
u2690.00 = √ = 2.88 × 10−3
2 3
2980.005 − 2979.995
u2980.00 = √ = 2.88 × 10−3
2 3
3260.005 − 3259.995
u3260.00 = √ = 2.88 × 10−3
2 3

10.1.3 Sinusoidal Wave Signal


In this section, we determine the uncertainty in the measurement of the amplitudes and frequencies of the sinusoidal
wave.
3.545 − 3.535
u3.54 = √ = 2.88 × 10−3
2 3
210.005 − 209.995
u210.00 = √
2 3

11 Interpretation and Discussions


The sinusoidal wave has only on frequency because it is a ”basis vector” for the waves, a sinusoid is a basis for
different patterns of waves.

11.1 Tasks
In this section, I answer the questions asked in lab manual.

11.1.1 Function Generator Signals


In this section, I check the ratio of the first terms in my power spectrum against the subsequent terms in the
spectrum.

11.1.2 Triangular Wave


The ratios of the first value of the power spectrum against subsequent values is,
3.24 162
r1 = = = 9.53
0.34 17

15
3.24 324
r2 = = = 29.45
0.11 11
3.24
r3 = = 64.80
0.05
3.24
r4 = = 108.00
0.03
Next, we find that the ratio of the triangular signal function,
 
8 cos(t) cos(3t) cos(5t)
f (t) = + + + . . .
π 12 32 52

The the ratios are,


1
12
r1 = 1 =9
32
1
12
r2 = 1 = 25
52
1
12
r3 = 1 = 49
72
1
12
r4 = 1 = 81
92
These terms are really in a good agreement with each other when we compare them,

11.1.3 Square Wave Signal


In this section we compare the first values of the power spectrum with the subsequent values of the power spectrum.
4.84
r1 = = 3.93
1.23
4.84
r2 = = 4.70
1.03
4.84
r3 = = 7.81
0.62
4.84
r4 = = 9.68
0.50
4.84
r5 = = 9.88
0.49
The next ratios of the Fourier transform function for the square wave,
 
8 sin(t) sin(3t) sin(5t)
f (t) = + + + ...
π 1 3 5
are,
1
r1 = 1 =3
3
1
r2 = 1 =5
5
1
r3 = 1 =7
7
1
r4 = 1 =9
9
These terms are in general agreement with each other for the first few values of the power spectrum.

16
11.2 Task 2 : Microphone Signals
Filtering filters out certain signals of the wave and the plot below with a low pass filter of 200.00Hz applied illustrates
that, The filter blocked frequencies above 200.0Hz and allowed ones below it.

Figure 15: Tuning Fork with a low pass filter of 200.00Hz

11.3 Task 3 : Solar Panel Frequency


From the plot 14, we can infer that it take 0.1s to complete one wave, period and frequency are related by,
1 1
f= = = 10Hz
T 0.1
This oscillations comes from the fact that the panel is a unit of connected photovoltaic units/semi-conductor, and
the have connections in between them to transfer the electricity, once one connected is blocked by shade, the voltage
struggles to pass through and find alternate paths and start oscillating.

12 Task 4 : Equalizer
I think th equalizer work by performing a Fast Fourier Transform on the input signal and applies filters to adjust
the treble, base, midtone and volume by modifying wave characteristics such as frequency, wave-length and speed.

13 Conclusions
In this lab report we learnt and experimented with FFT and filters. We found that an FFT decomposes a signal
into its component basis ”sinusoid basis vectors”, and an equalizer modifies these properties to create new musical
beats.

17
References
[1] Bracewell, R.N., 1989. The fourier transform. Scientific American, 260(6), pp.86-95.

[2] Dyke, P., 2014. An introduction to Laplace transforms and Fourier series. Springer Science & Busi-
ness Media.

[3] Cochran, W.T., Cooley, J.W., Favin, D.L., Helms, H.D., Kaenel, R.A., Lang, W.W., Maling, G.C.,
Nelson, D.E., Rader, C.M. and Welch, P.D., 1967. What is the fast Fourier transform?. Proceedings of
the IEEE, 55(10), pp.1664-1674.

18
14 Links to code and data
The link to the code and data are attached in the following links.
Data and Code used for the experiment

19

You might also like