SlideShare a Scribd company logo
1 of 37
Download to read offline
IB Subject: Mathematics AA HL
Extended Essay
Title: Decoding Dogs’ Barks with Fourier Analysis
Research Question: How can Fourier Analysis be used to differentiate between the
motivational changes of a dog by examining the recordings of the dog’s barks?
Word Count: 3990
2
Table of Contents
1. Introduction 3
2. Fourier Analysis 4
2.1 Waveforms 4
2.2 Graphical Demonstrations of Waveforms 6
2.3 Fourier Series 10
2.4 Finding the Formulas for the Fourier Coefficients 11
2.5 Example of Fourier Series Calculated Algebraically 19
2.6 Complex Form of Fourier Series 20
2.7 Transitioning from Fourier Series to Fourier Transform 25
3. Application to Dog Barks 27
3.1 Method 27
3.2 Assumptions 28
3.3 Experimentation 30
3.3.1 Distress 31
3.3.2 Anger 32
3.3.3 Excitement 33
4. Conclusion and Evaluation 34
5. Bibliography 35
6. Appendices 36
3
1. Introduction
I grew up with my golden retriever Lucky. Throughout his life, I considered him
as my best friend. For this reason, trying to understand his emotions has a great
significance for me. I always wished to have a platform that could translate his barking
into a language that I could understand. However, I didn’t have any idea on how such
a platform could even be built. How could someone even begin translating barks into
a comprehensible language for humans?
A few years ago, I realized that Lucky’s barks had different acoustic patterns
when he was in different situations. For example, when he saw a cat, his barks were
low-pitched, thick and short. His motivational changes were clearly being mirrored in
his barking vocalizations. As a result, I was able to understand the situation that Lucky
was in without even seeing him. As an aspiring mathematician, I speculated that these
acoustic patterns might demonstrate certain mathematical patterns that could be
identified, which could be a first step in decoding dogs’ language. Therefore, after my
research on methods of mathematical sound analysis, I decided to conduct my essay
using Fourier Analysis, which is a method of transformation that decomposes a
certain non-periodic function, such as a sound wave, into a weighted sum of sines and
cosines.
My aim in this essay is to find a mathematical correlation between Lucky’s barks
and his motivational changes through Fourier Analysis, with my research question
being, how can Fourier Analysis be used to differentiate between the motivational
changes of a dog by examining the recordings of the dog’s barks?
4
I wrote the essay in two main parts. In the first part, I’ll give a detailed
explanation of Fourier Analysis. I’ll first start by introducing Fourier Series and give the
definitions of it. I’ll then give an example of Fourier Series calculated algebraically.
Next, I’ll explain the relationship between Fourier Series and Fourier Transform. Lastly,
I’ll relate Fourier Transform back to Lucky’s barks.
In the second part, I’ll apply Fourier Transform to different type of barking
sounds that I recorded in different situations, meaning different motivational changes.
In the end, I’ll compare the results that I found for each motivational change, and hence
conclude my essay by indicating the correlation that I identified.
2. Fourier Analysis
2.1 Waveforms
Waveforms are graphical representations of shapes of waves, and they portray
a certain characteristic of the wave, such as variations in amplitude, as a function of
time1
. A simple example of a periodic waveform can be the sine wave.
1
“Electrical Waveforms and Electrical Signals.” Basic Electronics Tutorials, 26 Apr. 2020,
www.electronics-tutorials.ws/waveforms/waveforms.html.
Graph 1: The amplitude (y-axis) of the waveform is graphed with
respect to time (x-axis).
5
However, sometimes waveforms might not be as simple as the sine wave. For
example, graph below shows the variations in amplitude of a seismic wave with respect
to time.
2
As it is seen, it will be difficult to perform calculations with the waveform above,
and it will be insufficient since it only gives an idea for variations in amplitude.
Therefore, it will not always be useful to think waveforms in time domain. In fact,
regardless of how complex a waveform might be, all waveforms in the universe are
composed of sinusoidal functions of different frequencies, and hence can be written as
the sum of those functions. Thus, instead of
plotting a seemingly complicated waveform as a
function of time, we can transform it from the time
domain into the frequency domain, in which
frequency is independent variable instead of time.
3
2
Das, Kaushik & Ghosh, Amitava & Basu, Debashis & Miller, Larry. (2014). Soil Structure and Fluid
Interaction Assessment of New Modular Reactor: Part 1 — Numerical Simulation of Fluid Motion due to
Seismic Waves. ASME 2014 Small Modular Reactors Symposium, SMR 2014. 10.1115/SMR2014-
3319.
3
“Home En.” FFT, www.nti-audio.com/en/support/know-how/fast-fourier-transform-fft
Figure 1: A seismic waveform.
Figure 2: Transforming a waveform from the time
domain to the frequency domain.
6
2.2 Graphical Demonstrations of Waveforms
The following examples will demonstrate how a waveform can be made up of
different sinusoidal functions.4
To start with, let’s examine the function 𝑥(𝑡) below,
where the y-axis indicates the amplitude, and the x-axis indicates the time.
The function 𝑥(𝑡) is in fact the result of the summation of three different
sinusodial functions. This was an example function that I created to show that when
combined, functions with different periods and amplitudes can produce a rather
complicated function. The first component of the function is a sine wave with the
equation 𝑦 = 𝑠𝑖𝑛(2𝜋𝑡), meaning an amplitude A = 1 and period T = 1, as represented
below.
4
Demonstration inspired by: “Fourier Series.” Math Is Fun, www.mathsisfun.com/calculus/fourier-
series.html.
Graph 3: First frequency component Graph 4: First frequency component and x(t)
Graph 2: Graph of x(t)
7
The second component is a cosine wave with the equation 𝑦 =
!
"
𝑐𝑜𝑠 0
#
$
𝜋𝑡1,
meaning an amplitude of A =
!
"
and a period of T = 2.5, as shown below.
Similarly, the third component of 𝑥(𝑡) is again a cosine wave with the equation
𝑦 =
%
&
𝑐𝑜𝑠(6𝜋𝑡), meaning an amplitude, A =
%
&
and period T =
%
!
, as shown in below.
As a result, the 𝑥(𝑡) can be written as the sum of the three components:
Graph 7: Third frequency component Graph 8: Third frequency component and x(t)
Graph 5: Second frequency component Graph 6: Second frequency component and x(t)
8
𝑥(𝑡) = 𝑠𝑖𝑛(2𝜋𝑡) +
3
7
𝑐𝑜𝑠 6
4
5
𝜋𝑡9 +
1
2
𝑐𝑜𝑠(6𝜋𝑡)
While 𝑥(𝑡) is a made-up function, all waveforms can be decomposed into such
sinusodial functions. However, the number of sines and cosines that are going to be
summed up is not limited. Conversely, we can add infinite number of sines and cosines
to form a waveform. The following periodic function, the square wave, is a simple
example of this situation.
The square wave is composed of infinitely many sine waves of different
frequencies. The first component of the square wave can be a simple sine wave, for
example 𝑦 = 𝑠𝑖𝑛(𝜋𝑡), meaning an amplitude of A = 1 and period of T = 2.
Graph 10: Graph of 𝑦 = 𝑠𝑖𝑛(𝜋𝑡)
Graph 9: A square wave
9
Then, we can add another sine wave with one third of amplitude and three times
the frequency, so the resultant function becomes:
We can add another layer of sine wave on top of the previous sum, but this time
with one fifth the amplitude and five times the frequency.
It is clearly seen that as we keep adding new sine waves with this odd number
pattern, meaning with amplitudes
%
&'(%
times and frequencies 2𝑛 + 1, 𝑛 ∈ ℕ times the
first component, then the “humps” (shown below) will get smaller and smaller.
Graph 11: Graph of 𝑦 = 𝑠𝑖𝑛(𝜋𝑡) +
!
"
𝑠𝑖𝑛(3𝜋𝑡)
Graph 12: Graph of 𝑦 = 𝑠𝑖𝑛(𝜋𝑡) +
!
"
𝑠𝑖𝑛(3𝜋𝑡) +
!
#
𝑠𝑖𝑛(5𝜋𝑡)
10
If we add infinite amount of sine waves together, the “humps” will look like a
straight line, and the square wave, shown in Graph 9, will form.
2.3 Fourier Series
The square wave is a certain example, but there are many other periodic
waveforms that can be written as the sum of infinitely many sines and cosines. Hence,
we can deduce a formula that generalizes the equation of a periodic waveform as
follows:
Let 𝑓(𝑥) be a periodic function of time defined on the interval [−𝜋, 𝜋], where the
function’s period is 2𝜋. Then, 𝑓(𝑥) can be found with the following formula:
𝑓(𝑥) = 𝑎) + @[𝑎'𝑠𝑖𝑛(𝑛𝑥)] + @[𝑏'𝑐𝑜𝑠(𝑛𝑥)]
*
'+%
*
'+%
Where n is a positive integer. In fact, this formula is called the Fourier Series.
𝑓(𝑥) is the function whose Fourier Series we want to calculate, and the right side of
the formula is its Fourier Series. Moreover, in this formula, 𝑎), 𝑎', and 𝑏' are called
the Fourier Coefficients, and obtaining the Fourier Series of a function means
These “humps” will get smaller
each time we add a new term.
Graph 13: Graph of 𝑦 = 𝑠𝑖𝑛(𝜋𝑡) +
!
"
𝑠𝑖𝑛(3𝜋𝑡) +
!
#
𝑠𝑖𝑛(5𝜋𝑡) +
!
$
𝑠𝑖𝑛(7𝜋𝑡) +
!
%
𝑠𝑖𝑛(9𝜋𝑡) +
!
!!
𝑠𝑖𝑛(11𝜋𝑡) +
!
!"
𝑠𝑖𝑛(13𝜋𝑡) +
!
!#
𝑠𝑖𝑛(15𝜋𝑡)
(1)
11
calculating the values of these coefficients. Each of these coefficients can be
calculated with their own unique formulas:
𝑎) =
1
2𝜋
D 𝑓(𝑥)𝑑𝑥
,
-,
𝑎' =
1
𝜋
D 𝑓(𝑥)𝑠𝑖𝑛(𝑛𝑥)𝑑𝑥
,
-,
𝑏' =
1
𝜋
D 𝑓(𝑥)𝑐𝑜𝑠(𝑛𝑥)𝑑𝑥
,
-,
2.4 Finding the Formulas for the Fourier Coefficients
In the section below, I will show how the formulas above are obtained 5
. First,
we are going to find the formula for 𝑎). Let’s integrate both sides in the formula (1).
D 𝑓(𝑥)𝑑𝑥
,
-,
= D 𝑎)
,
-,
𝑑𝑥 + D @[𝑎'𝑠𝑖𝑛(𝑛𝑥)]
*
'+%
,
-,
𝑑𝑥 + D @[𝑏'𝑐𝑜𝑠(𝑛𝑥)]
*
'+%
,
-,
𝑑𝑥
The key here is the interval that we are integrating the functions over. Since sine and
cosine functions are periodic, it will be sufficient to define the integral over the interval
[−𝜋, 𝜋], and it will be much easier for the calculations. Next, we can take the
coefficients out of the integral:
D 𝑓(𝑥)𝑑𝑥
,
-,
= 𝑎) D 𝑑𝑥
,
-,
+ @ 𝑎'
*
'+%
D 𝑠𝑖𝑛(𝑛𝑥)
,
-,
𝑑𝑥 + @ 𝑏'
*
'+%
D 𝑐𝑜𝑠(𝑛𝑥)
,
-,
𝑑𝑥
5
Derivation adapted from: blackpenredpen. “Fourier Series Coefficients.” YouTube, 4 Jan. 2019,
youtu.be/iSw2xFhMRN0.
12
Now, we will calculate the values of ∫ 𝑠𝑖𝑛(𝑛𝑥)
,
-,
𝑑𝑥 and ∫ 𝑐𝑜𝑠(𝑛𝑥)
,
-,
𝑑𝑥.
D 𝑠𝑖𝑛(𝑛𝑥)
,
-,
𝑑𝑥 = −
1
𝑛
𝑐𝑜𝑠(𝑛𝑥)G = −
1
𝑛
𝑐𝑜𝑠(𝑛𝜋) +
1
𝑛
𝑐𝑜𝑠(−𝑛𝜋)
This will always be 0, as when n is an even number both 𝑐𝑜𝑠(𝑛𝜋) and 𝑐𝑜𝑠(−𝑛𝜋) will be
1 and hence they will cancel out each other. Similarly, when n is an odd number, both
𝑐𝑜𝑠(𝑛𝜋) and 𝑐𝑜𝑠(−𝑛𝜋) will be -1 and they will cancel out each other. Similarly:
D 𝑐𝑜𝑠(𝑛𝑥)
,
-,
𝑑𝑥 =
1
𝑛
𝑠𝑖𝑛(𝑛𝑥)G =
1
𝑛
𝑠𝑖𝑛(𝑛𝜋) −
1
𝑛
𝑠𝑖𝑛(−𝑛𝜋)
This expression will also be 0, as the sine of any multiple of 𝜋 is 0. Hence, we can
rewrite the above equation as:
D 𝑓(𝑥)𝑑𝑥
,
-,
= 𝑎) D 𝑑𝑥
,
-,
D 𝑓(𝑥)𝑑𝑥
,
-,
= 2𝜋𝑎)
𝒂𝟎 =
𝟏
𝟐𝝅
D 𝒇(𝒙)𝒅𝒙
𝝅
-𝝅
.
Therefore, 𝑎) can also be seen as the average value of 𝑓(𝑥) over an entire period.
Secondly, we fill find the formula for 𝑏'. Let’s rewrite the formula (1).
𝑓(𝑥) = 𝑎) + @[𝑎'𝑠𝑖𝑛(𝑛𝑥)] + @[𝑏'𝑐𝑜𝑠(𝑛𝑥)]
*
'+%
*
'+%
𝜋
−𝜋
𝜋
−𝜋
(2)
(3)
13
Then, we are going to multiply each term by 𝑐𝑜𝑠(𝑚𝑥)𝑑𝑥, (m is a positive integer) to
help us convert the expression into the formula for 𝑏'. and integrate both sides.
D 𝑓(𝑥)𝑐𝑜𝑠(𝑚𝑥)𝑑𝑥
,
-,
= D 𝑎)
,
-,
𝑐𝑜𝑠(𝑚𝑥)𝑑𝑥 + D @[𝑎'𝑠𝑖𝑛(𝑛𝑥)𝑐𝑜𝑠(𝑚𝑥)]
*
'+%
,
-,
𝑑𝑥
+ D @[𝑏'𝑐𝑜𝑠(𝑛𝑥)𝑐𝑜𝑠(𝑚𝑥)]
*
'+%
,
-,
𝑑𝑥
We can take the coefficients out of the integral:
D 𝑓(𝑥)𝑐𝑜𝑠(𝑚𝑥)𝑑𝑥
,
-,
= 𝑎) D 𝑐𝑜𝑠(𝑚𝑥)𝑑𝑥
,
-,
+ @ 𝑎'
*
'+%
D 𝑠𝑖𝑛(𝑛𝑥)𝑐𝑜𝑠(𝑚𝑥)
,
-,
𝑑𝑥
+ @ 𝑏'
*
'+%
D 𝑐𝑜𝑠(𝑛𝑥)
,
-,
𝑐𝑜𝑠(𝑚𝑥)𝑑𝑥
We know that ∫ 𝑐𝑜𝑠(𝑚𝑥)𝑑𝑥
,
-,
is 0 from our previous calculations on expression (3).
Hence, we have to calculate ∫ 𝑠𝑖𝑛(𝑛𝑥)𝑐𝑜𝑠(𝑚𝑥)
,
-,
𝑑𝑥. From the trigonometric identity in
Appendix C, we can rewrite the integral as:
D
1
2
[𝑠𝑖𝑛((𝑛 + 𝑚)𝑥) + 𝑠𝑖𝑛((𝑛 − 𝑚)𝑥)]
,
-,
𝑑𝑥 =
1
2
D 𝑠𝑖𝑛((𝑛 + 𝑚)𝑥)𝑑𝑥
,
-,
+
1
2
D 𝑠𝑖𝑛((𝑛 − 𝑚)𝑥)𝑑𝑥
,
-,
(4)
14
If 𝑛 ≠ 𝑚, then (n+m) and (n-m) will be non-zero integers. Hence, we know from the
calculation of the expressions (2), the definite integrals of ∫ 𝑠𝑖𝑛(𝑛𝑥)
,
-,
𝑑𝑥 when n is a
non-zero integer is going to be 0.
If 𝑛 = 𝑚, ∫ 𝑠𝑖𝑛((𝑛 + 𝑚)𝑥)
,
-,
𝑑𝑥 will still be 0, as (m+n) is still going to be a non-zero
integer. Moreover, (n-m) will be 0, and so
%
&
∫ 𝑠𝑖𝑛((𝑛 − 𝑚)𝑥)
,
-,
𝑑𝑥 will be 0.
In either case, ∫ 𝑠𝑖𝑛(𝑛𝑥)𝑐𝑜𝑠(𝑚𝑥)
,
-,
𝑑𝑥 will be 0. Hence, equation (4) can be rewritten
as:
D 𝑓(𝑥)𝑐𝑜𝑠(𝑚𝑥)𝑑𝑥
,
-,
= @ 𝑏'
*
'+%
D 𝑐𝑜𝑠(𝑛𝑥)
,
-,
𝑐𝑜𝑠(𝑚𝑥)𝑑𝑥
Now, we have to calculate ∫ 𝑐𝑜𝑠(𝑛𝑥)
,
-,
𝑐𝑜𝑠(𝑚𝑥)𝑑𝑥. From the trigonometric identity in
Appendix A, we can rewrite the integral as:
D
1
2
[𝑐𝑜𝑠((𝑛 − 𝑚)𝑥) + 𝑐𝑜𝑠((𝑚 + 𝑛)𝑥)]
,
-,
𝑑𝑥 =
1
2
D 𝑐𝑜𝑠((𝑛 − 𝑚)𝑥)𝑑𝑥
,
-,
+
1
2
D 𝑐𝑜𝑠((𝑛 + 𝑚)𝑥)𝑑𝑥
,
-,
If 𝑛 ≠ 𝑚, then (n-m) and (n+m) will be non-zero integers. Hence, we know from the
calculation of the expression (3), the definite integral of ∫ 𝑐𝑜𝑠(𝑚𝑥)𝑑𝑥
,
-,
when m is a
non-zero integer is going to be 0. Hence, the expression ∫ 𝑐𝑜𝑠(𝑛𝑥)
,
-,
𝑐𝑜𝑠(𝑚𝑥)𝑑𝑥 will be
0.
(5)
15
If 𝑛 = 𝑚, ∫ 𝑐𝑜𝑠((𝑚 + 𝑛)𝑥)]
,
-,
𝑑𝑥 will still be 0, as (m+n) is still going to be a non-zero
integer. Moreover, (n-m) will be 0, and
%
&
∫ [𝑐𝑜𝑠((𝑛 − 𝑚)𝑥)𝑑𝑥
,
-,
will be rewritten as:
1
2
D 1𝑑𝑥
,
-,
=
1
2
(𝑥)| =
𝜋
2
−
−𝜋
2
=
2𝜋
2
= 𝜋
Since the Sigma Notation runs over all possible n, at some point, n will be m. Therefore,
the right-hand side of the equation (5) will be 𝜋𝑏0. Hence:
D 𝑓(𝑥)𝑐𝑜𝑠(𝑚𝑥)𝑑𝑥
,
-,
= 𝜋𝑏0
𝑏0 =
1
𝜋
D 𝑓(𝑥)𝑐𝑜𝑠(𝑚𝑥)𝑑𝑥
,
-,
We can relabel the m as n:
𝒃𝒏 =
𝟏
𝝅
D 𝒇(𝒙)𝒄𝒐𝒔(𝒏𝒙)𝒅𝒙.
𝝅
-𝝅
Similarly, we can find the formula for 𝑎'. First, we are going to multiply each term in
formula (1) with 𝑠𝑖𝑛(𝑚𝑥)𝑑𝑥 and then will integrate both sides.
D 𝑓(𝑥)𝑠𝑖𝑛(𝑚𝑥)𝑑𝑥
,
-,
= D 𝑎)
,
-,
𝑠𝑖𝑛(𝑚𝑥)𝑑𝑥 + D @[𝑎'𝑠𝑖𝑛(𝑛𝑥)𝑠𝑖𝑛(𝑚𝑥)]
*
'+%
,
-,
𝑑𝑥
+ D @[𝑏'𝑐𝑜𝑠(𝑛𝑥)𝑠𝑖𝑛(𝑚𝑥)]
*
'+%
,
-,
𝑑𝑥
𝜋
−𝜋
16
We can take the coefficients out of the integral:
D 𝑓(𝑥)𝑠𝑖𝑛(𝑚𝑥)𝑑𝑥
,
-,
= 𝑎) D 𝑠𝑖𝑛(𝑚𝑥)𝑑𝑥
,
-,
+ @ 𝑎'
*
'+%
D 𝑠𝑖𝑛(𝑛𝑥)𝑠𝑖𝑛(𝑚𝑥)
,
-,
𝑑𝑥
+ @ 𝑏'
*
'+%
D 𝑐𝑜𝑠(𝑛𝑥)
,
-,
𝑠𝑖𝑛(𝑚𝑥)𝑑𝑥
We know that ∫ 𝑠𝑖𝑛(𝑚𝑥)𝑑𝑥
,
-,
is 0 from our previous calculations on expression (2).
Hence, we have to calculate ∫ 𝑐𝑜𝑠(𝑛𝑥)
,
-,
𝑠𝑖𝑛(𝑚𝑥)𝑑𝑥. From the trigonometric identity in
Appendix D, we can rewrite the integral as:
D
1
2
[𝑠𝑖𝑛((𝑛 + 𝑚)𝑥) − 𝑠𝑖𝑛((𝑛 − 𝑚)𝑥)]
,
-,
𝑑𝑥 =
1
2
D 𝑠𝑖𝑛((𝑛 + 𝑚)𝑥)𝑑𝑥
,
-,
−
1
2
D 𝑠𝑖𝑛((𝑛 − 𝑚)𝑥)𝑑𝑥
,
-,
If 𝑛 ≠ 𝑚, then (n+m) and (n-m) will be non-zero integers. Hence, we know from the
calculation of the expressions (2), the definite integrals of ∫ 𝑠𝑖𝑛(𝑛𝑥)
,
-,
𝑑𝑥 when n is a
non-zero integer is going to be 0.
If 𝑛 = 𝑚, ∫ 𝑠𝑖𝑛((𝑛 + 𝑚)𝑥)
,
-,
𝑑𝑥 will still be 0, as (m+n) is still going to be a non-zero
integer. Moreover, (n-m) will be 0, and so
%
&
∫ 𝑠𝑖𝑛((𝑛 − 𝑚)𝑥)
,
-,
𝑑𝑥 will be 0.
In either case, ∫ 𝑐𝑜𝑠(𝑛𝑥)
,
-,
𝑠𝑖𝑛(𝑚𝑥)𝑑𝑥 will be 0. Hence, equation (6) can be rewritten
as:
(6)
17
D 𝑓(𝑥)𝑠𝑖𝑛(𝑚𝑥)𝑑𝑥
,
-,
= @ 𝑎'
*
'+%
D 𝑠𝑖𝑛(𝑛𝑥)
,
-,
𝑠𝑖𝑛(𝑚𝑥)𝑑𝑥
Now, we have to calculate ∫ 𝑠𝑖𝑛(𝑛𝑥)
,
-,
𝑠𝑖𝑛(𝑚𝑥)𝑑𝑥. From the trigonometric identity in
Appendix B, we can rewrite the integral as:
D
1
2
[𝑐𝑜𝑠((𝑛 − 𝑚)𝑥) − 𝑐𝑜𝑠((𝑚 + 𝑛)𝑥)]
,
-,
𝑑𝑥 =
1
2
D 𝑐𝑜𝑠((𝑛 − 𝑚)𝑥)𝑑𝑥
,
-,
−
1
2
D 𝑐𝑜𝑠((𝑚 + 𝑛)𝑥)𝑑𝑥
,
-,
If 𝑛 ≠ 𝑚, then (n-m) and (n+m) will be non-zero integers. Hence, we know from the
calculation of the expression (3), the definite integral of ∫ 𝑐𝑜𝑠(𝑚𝑥)𝑑𝑥
,
-,
when m is a
non-zero integer is going to be 0. Hence, the expression ∫ 𝑠𝑖𝑛(𝑛𝑥)
,
-,
𝑠𝑖𝑛(𝑚𝑥)𝑑𝑥 will be
equal to 0.
If 𝑛 = 𝑚, ∫ 𝑐𝑜𝑠((𝑚 + 𝑛)𝑥)]
,
-,
𝑑𝑥 will still be 0, as (m+n) is still going to be a non-zero
integer. Moreover, (n-m) will be 0, and
%
&
∫ [𝑐𝑜𝑠((𝑛 − 𝑚)𝑥)𝑑𝑥
,
-,
will be rewritten as:
1
2
D 1𝑑𝑥
,
-,
=
1
2
(𝑥)| =
𝜋
2
−
−𝜋
2
=
2𝜋
2
= 𝜋
Since the Sigma Notation runs over all possible n, at some point, n will be m. Therefore,
the right-hand side of equation (7) will be 𝜋𝑎0. Hence:
𝜋
−𝜋
(7)
18
D 𝑓(𝑥)𝑠𝑖𝑛(𝑚𝑥)𝑑𝑥
,
-,
= 𝜋𝑎0
𝑎0 =
1
𝜋
D 𝑓(𝑥)𝑠𝑖𝑛(𝑚𝑥)𝑑𝑥
,
-,
We can relabel the m as n:
𝒂𝒏 =
𝟏
𝝅
D 𝒇(𝒙)𝒔𝒊𝒏(𝒏𝒙)𝒅𝒙.
𝝅
-𝝅
Using these three formulas, we can calculate the Fourier Coefficients. The value
of those coefficients will inform us about the weight of each frequency in the waveform,
indicating how much of which sinusodial wave should be added in order to produce the
original waveform. This is illustrated in the figure below.
6
6
Viktor Lavrenko. “IAML2.19: Representing music with Fourier coefficients”. Online video clip. YouTube.
YouTube, 10 September 2015.
Figure 3: Taken from Viktor Lavrenko. The graph shows a simple illustration of
how the Fourier Coefficients can inform us about the weight of the frequencies
present in the original function.
19
2.5 Example of Fourier Series Calculated Algebraically
In this part, I will calculate the Fourier Series of the square wave by using the
Fourier Coefficients.
Firstly, our square wave is going to have a period of 2𝜋, and will be defined on
the interval [−𝜋, 𝜋]. The function for the wave will be as follows 7
:
𝑓(𝑥) = Y
0, −𝜋 ≤ 𝑥 ≤ 0
1, 0 < 𝑥 ≤ 𝜋
Firstly, we will calculate the coefficient 𝑎):
𝑎) =
1
2𝜋
D 𝑓(𝑥)𝑑𝑥
,
-,
Since between −𝜋 and 0 the function is 0, we can rewrite the integral as:
𝑎) =
1
2𝜋
D 𝑓(𝑥)𝑑𝑥
,
)
=
1
2𝜋
D 1𝑑𝑥 =
1
2𝜋
∙ 𝜋 =
1
2
,
)
Next, we will find the coefficient 𝑎':
7
“Definition of Fourier Series and Typical Examples.” Math24, 26 Apr. 2020, www.math24.net/fourier-
series-definition-typical-examples/#example2.
20
𝑎' =
1
𝜋
D 𝑓(𝑥)𝑠𝑖𝑛(𝑛𝑥)𝑑𝑥
,
-,
=
1
𝜋
D 𝑓(𝑥)𝑠𝑖𝑛(𝑛𝑥)𝑑𝑥
,
)
=
1
𝜋
D 1𝑠𝑖𝑛(𝑛𝑥)𝑑𝑥
,
)
=
1
𝜋
^ 6 −
𝑐𝑜𝑠(𝑛𝑥)
𝑛
9G _ = −
1
𝜋𝑛
∙ (𝑐𝑜𝑠(𝑛𝜋) − 𝑐𝑜𝑠(0)) =
1 − 𝑐𝑜𝑠(𝑛𝜋)
𝜋𝑛
Since 𝑐𝑜𝑠(𝑛𝜋) = (−1)'
, the expression can turn into:
𝑎' =
1 − (−1)'
𝜋𝑛
After, we will find the coefficient 𝑏':
𝑏' =
1
𝜋
D 𝑓(𝑥)𝑐𝑜𝑠(𝑛𝑥)𝑑𝑥
,
-,
=
1
𝜋
D 𝑓(𝑥)𝑐𝑜𝑠(𝑛𝑥)𝑑𝑥
,
)
=
1
𝜋
D 1𝑐𝑜𝑠(𝑛𝑥)𝑑𝑥
,
-,
=
1
𝜋
^ 6
𝑠𝑖𝑛(𝑛𝑥)
𝑛
9G _ =
1
𝜋𝑛
∙ 0 = 0
Hence, the Fourier Series of this square wave will be:
𝑓(𝑥) =
1
2
+ @ ^
1 − (−1)'
𝜋𝑛
𝑠𝑖𝑛(𝑛𝑥)_
*
'+%
2.6 Complex Form of Fourier Series
It is now possible for us to calculate the Fourier Series coefficients of any
periodic function. However, there are several drawbacks of this method. Firstly, integral
calculations can be relatively difficult for large numbers. Secondly, some waveforms
will have infinitely many coefficients and it will be impossible to calculate them all with
this approach. Therefore, using complex numbers will significantly make the
calculations easier. Hence, we will now derive the complex exponential formula for
Formula (1).
𝜋
0
𝜋
0
21
We’ll start with the Euler’s formula:
𝑒23
= 𝑐𝑜𝑠𝜃 + 𝑖𝑠𝑖𝑛 𝜃
Next, we’ll have to find the complex definitions of the sine and cosine. Let’s plug in a
negative into the argument:
𝑒-23
= 𝑐𝑜𝑠𝜃 − 𝑖𝑠𝑖𝑛 𝜃
If we add these two equations together:
𝑒23
+ 𝑒-23
= 2𝑐𝑜𝑠𝜃
𝑐𝑜𝑠𝜃 =
𝑒23
+ 𝑒-23
2
Similarly:
𝑒23
− 𝑒-23
= 2𝑖𝑠𝑖𝑛𝜃
𝑠𝑖𝑛𝜃 =
𝑒23
+ 𝑒-23
2𝑖
Substituting into the Fourier Series formula, where 𝜃 = 𝑛𝑥 (since in the formula we
wrote sin(nx)):
22
𝑓(𝑥) = 𝑎) + @ b𝑎' c
𝑒2'4
+ 𝑒-2'4
2𝑖
de + @ b𝑏' c
𝑒2'4
+ 𝑒-2'4
2
de
*
'+%
*
'+%
= 𝑎) + @ b𝑎' c
−𝑖𝑒2'4
+ 𝑖𝑒-2'4
2
de + @ b𝑏' c
𝑒2'4
+ 𝑒-2'4
2
de
*
'+%
*
'+%
= 𝑎) + @ ^𝑒-2'4
6
𝑏' + 𝑖𝑎'
2
9_ + @ ^ 𝑒2'4
6
𝑏' − 𝑖𝑎'
2
9_
*
'+%
*
'+%
Next, we will resubstitute coefficients:
𝑐' =
𝑏' − 𝑖𝑎'
2
𝑐-' =
𝑏' + 𝑖𝑎'
2
𝑐) = 𝑎)
This substitution will factor the 𝑎) into the sum. Hence:
𝑓(𝑥) = @f𝑐-'𝑒-2'4
+ 𝑐' 𝑒2'4
g
*
'+)
The n’s on the left-hand side of the equation can be changed as -n to break the
expression down to two summations:
𝑓(𝑥) = @ f𝑐'𝑒2'4
g + @f𝑐' 𝑒2'4
g
*
'+)
)
'+-*
𝒇(𝒙) = @ [𝒄𝒏 𝒆𝒊𝒏𝒙]
*
𝒏+-*
(8)
23
Where:
𝑐' =
⎩
⎪
⎨
⎪
⎧
𝑏' − 𝑖𝑎'
2
𝑛 > 0
𝑏-' + 𝑖𝑎-'
2
𝑛 < 0
𝑎) 𝑛 = 0
Now that we have the complex form, we can find the formula for 𝑐'. To do that, we’ll
first multiply both sides of the equation by 𝑒-204
and take the integral:
D 𝑓(𝑥)𝑒-204
𝑑𝑥
,
-,
= @ 𝑐' D 𝑒2'4
𝑒-204
𝑑𝑥
,
-,
*
'+-*
For the integral on the right-hand side, there are two possibilities:
D 𝑒2'4
𝑒-204
𝑑𝑥
,
-,
= Y
0, 𝑛 ≠ 𝑚
2𝜋, 𝑛 = 𝑚
Since Sigma Notation runs over all possible n, at some point, n will be m Therefore,
we can write the result of the integral as 2𝜋:
D 𝑓(𝑥)𝑒-204
𝑑𝑥
,
-,
= 2𝜋 ∙ 𝑐0
We can relabel m as n:
D 𝑓(𝑥)𝑒-2'4
𝑑𝑥
,
-,
= 2𝜋 ∙ 𝑐'
𝒄𝒏 =
𝟏
𝟐𝝅
D 𝒇(𝒙)𝒆-𝒊𝒏𝒙
𝒅𝒙
𝝅
-𝝅
(9)
24
An important point here is that when we first introduced formula (1), we defined
the interval as [−𝜋, 𝜋] and made all of the calculations accordingly. However, not all
functions have such a period. Hence, if we generalize the formulas 8 and 9, then we
will be able to apply it to any other periodic function. Although dog barks are not usually
periodic, generalizing the formula will help us extend our calculations to non-periodic
functions, as we will see in 2.7. The generalization for Fourier Series to any periodic
function is as follows:
𝑓(𝑥) = 𝑎) + @[𝑎'𝑠𝑖𝑛 0
𝑛𝜋𝑥
𝐿
1] + @[𝑏'𝑐𝑜𝑠 0
𝑛𝜋𝑥
𝐿
1]
*
'+%
*
'+%
Where the period of the function is denoted by 2L. Notice that in formula (1), the
period of the function was 2𝜋, so when substituted, we substituted 𝜋 for L, we were left
with 𝑛𝑥. Therefore, in formulas above, plugging in
',4
7
instead of 𝑛𝑥 will help us find
the generalizations of the formulas.
Firstly, if we consider formula (8), and substitute
',4
7
for 𝑛𝑥, we will get the
formula below, which is the generalization of the complex form of Fourier Series for
any function with a period of 2L:
𝒇(𝒙) = @ ^𝒄𝒏 𝒆
𝒊𝒏𝝅𝒙
𝑳 _
*
𝒏+-*
Similarly, we can generalize formula (9) as well. Not that in formula (9), the
period of the function was 2𝜋, and it is written in the form of a multiplicative inverse.
(10)
25
Hence, instead of 2𝜋, we will plug in 2𝐿, and the integral will be defined over the interval
[−𝐿, 𝐿]:
𝒄𝒏 =
𝟏
𝟐𝑳
D 𝒇(𝒙)𝒆-
𝒊𝒏𝝅𝒙
𝑳 𝒅𝒙
𝑳
-𝑳
2.7 Transitioning from Fourier Series to Fourier Transform
Fourier Series can be very useful to decompose a waveform, but it only works
for periodic functions. However, in nature, sounds are usually not periodic. Therefore,
we have to find another method that can decompose a non-periodic function. This
method is called the Fourier Transform, and it has an algebraic formula, which can
be derived as following 8
:
Let 𝜔 =
',
7
and since n is the variable, let ∆𝜔 =
,
7
:
𝑐' =
1
2𝐿
D 𝑓(𝑥)𝑒-294
𝑑𝑥
7
-7
We can define a function, 𝐹(𝛿), where 𝛿 is a variable:
𝐹(𝛿) = D 𝑓(𝑥)𝑒-2:4
𝑑𝑥
7
-7
8
Derivation adapted from: Physics and Math Lectures. Deriving the Fourier Transform From Fourier
Series. YouTube, 2 July 2020, www.youtube.com/watch?v=wmUdNKLrWeo.
26
𝑐' =
1
2𝐿
𝐹(𝜔)
Plugging to the complex form of the Fourier Series:
𝑓(𝑥) = @ ^
1
2𝐿
𝐹(𝜔) 𝑒294
_
*
'+-*
Since ∆𝜔 =
,
7
,
%
&7
will be
∆9
&,
. Hence:
𝑓(𝑥) = @ ^
1
2𝜋
𝐹(𝜔) 𝑒294
∙ ∆𝜔_
*
'+-*
In fact, this expression looks much like the Sigma notation of a Reimann Sum.
Moreover, since now we want to deal with non-periodic functions, we don’t need to
have an interval that defines us the period of the function. Hence, instead of [−𝐿, 𝐿],
we can define our interval as (−∞, ∞). Therefore, L will approach to infinity, while ∆𝜔
will keep getting smaller, approaching 0. Hence, we can convert above expression into
an integral, as below:
𝒇(𝒙) =
𝟏
𝟐𝝅
D 𝑭(𝝎)
*
-*
𝒆𝒊𝝎𝒙
𝒅𝝎
With this formula, known as Inverse Fourier Transform, we can use a function
of 𝜔, to find a function of time, 𝑓(𝑥). Similarly, we have a function of time, 𝑓(𝑥), and
27
we want to define it as a function of 𝜔, we will use the formula that we defined above,
which is known as Fourier Transform:
𝓕{𝒇(𝒙)} = 𝑭(𝝎) = D 𝒇(𝒙)𝒆-𝒊𝝎𝒙
𝒅𝒙
*
-*
Therefore, since frequency is defined as
%
=
(T = period), and since we had
defined 𝜔 as
',
7
(L = half of the period), we can conclude that the domain of the function
𝐹(𝜔) will be the frequency. Thus, with Fourier Transform, we’ll be able to transform a
function from time domain to frequency domain, as previously seen in Figure 2.
3. Application to Dog Barks
When we have a seemingly complicated function, it can be difficult to find the
result analytically. Moreover, sometimes it can be very difficult to write a waveform as
a function. In such cases, we can transform them into their frequency domains
computationally. In my investigation with dog barks, I’ll use the programming platform
MATLAB to analyze recordings.
3.1 Method
I decided to record Lucky’s barks in order to detect any patterns that might be
correlated with his motivational changes. I used a program called Audacity to record,
which allowed me to visually see the waveforms. After, I used MATLAB to apply Fourier
Transform algorithm to recordings.
28
Note that I didn’t cause any harm to Lucky while my experimentation. I recorded
him when he was barking for a natural cause.
3.2 Assumptions
My study starts with two critical assumptions:
1) Dogs have some fundamental emotions.
2) Dogs emit acoustically different barks in different situations.
The first assumption is scientifically proven. According to Stanley Coren, “Dogs
have same hormones and undergo the same chemical changes that humans do during
emotional states. Dogs even have the hormone oxytocin, which, in humans, is involved
with feeling love and affection for others. With the same neurology and chemistry that
people have, it seems reasonable to suggest that dogs also have emotions that are
similar to ours.9
” In fact, dogs possess similar emotions of a 2.5-year-old person, as
seen in below:
9
“Which Emotions Do Dogs Actually Experience?” Modern Dog Magazine,
moderndogmagazine.com/articles/which-emotions-do-dogs-actually-experience/32883.
Figure 4: The emotional range of dogs 9
.
29
The second assumption will be tested with my experimentation. With Fourier
Analysis, I’ll explore frequency domains of each recording and try to detect frequency
changes that occur in different situations. For my study, I have determined three
situations:
1) In this situation, I recorded Lucky’s barks for 1-2 mins. when my family and I
were leaving our house and Lucky was going to stay alone.
2) We live in a neighborhood that is inhabited by many cats. In this situation, I
recorded Lucky’s barks for 1 to 2 mins. when he saw a cat.
3) In this situation, I recorded Lucky’s barks for approximately. 1-2 mins when I
took his leash and prepared to go for a walk.
To distinguish these situations, I named all three situations as below:
Situation 1: Distress
Situation 2: Anger
Situation 3: Excitement
Although these emotions might not be accurate, these are only going to be used
as a “label” for us to name different motivational changes of dogs. So, my intention
here is to not find the real emotions that the dog feels in that situation, rather, to find
what changes that acoustically occur in his barks when he’s in different situations.
Therefore, the naming of emotions is not significant in my study. However, it was
important to know that dogs can feel different emotions, as it suggests that they can
30
have different motivational changes. In my study, I did three recordings for each
situation, resulting in a total of 9 recordings.
3.3 Experimentation
MATLAB code that I will use to find frequency domains of my recordings is below 10
:
10
Code adapted from: 262588213843476. “Plotting the Signal and Fourier Transform in Matlab.” Gist,
gist.github.com/pbianche/2584364.
Figure 5: MATLAB Code
31
3.3.1 Distress
Barks in this situation can be described as high-pitched and similar to a howling.
The visualization of an example recording in this situation can be seen below:
When MATLAB code is applied to three recordings, graphs bellow (Frequency
vs. Amplitude) will be generated:
As it can be clearly seen from the graphs, frequencies of three recordings were
cumulated around 800 Hz. Even though their amplitudes vary (this may be due to the
fact that the time I recorded each one was different, so the distance between Lucky
and my microphone varied each time), their frequencies are roughly around the same
value. Moreover, they also peak around the same value: Figure 7 around 800, Figure
8 around a little bit over 800, and Figure 9 around a bit less than 800. Hence, we can
generalize the frequency of distress type of barking as approximately 800 Hz.
Figure 6: Distressed barking of Lucky. Here, every blue trace represents a “Woof” sound that Lucky makes.
Figure 7: Distressed Barking 1. Figure 8: Distressed Barking 2. Figure 9: Distressed Barking 3.
32
3.3.2 Anger
Barks in this situation can be described as low-pitched, thick sounds. The
visualization of an example recording in this situation can be seen below:
When MATLAB code is applied to three recordings, graphs bellow (Frequency
vs. Amplitude) will be generated:
As it can be clearly seen from graphs, frequencies of three recordings were
cumulated around both 400/500 Hz and 800 Hz. Again, even though their amplitudes
vary (this is due to the fact that the distance between Lucky and my microphone varied
each time), their frequencies are roughly around the same value. Moreover, their peaks
are around the same value: Figure 11 around 400 Hz, Figure 12 around 500 Hz, and
Figure 13 around 500 Hz. Therefore, it can be seen that there’s a clear distinction from
distressed barks. Hence, we can generalize the frequency of. anger type of barking as
approximately 500 Hz.
Figure 10: Angry barking of Lucky. Here, every blue trace represents a “Woof” sound that Lucky makes.
Figure 11: Angry Barking 1. Figure 12: Angry Barking 2. Figure 13: Angry Barking 3.
33
3.3.3 Excitement
Barks in this situation can be described as neither high nor low-pitched. The
visualization of an example recording in this situation can be seen below:
When MATLAB code is applied to three recordings, graphs bellow (Frequency
vs. Amplitude) will be generated:
As it can be clearly seen from graphs, frequencies of three recordings were
cumulated around 600 Hz. Furthermore, peaks of all three are around 600 Hz although
there is also a small cumulation around 800 as well. Therefore, it can be seen that
there is distinction from other two type of barks, one being around 800 Hz and other
500 Hz. Hence, we can generalize the frequency of excited type of barking as
approximately 600 Hz.
Figure 14: Excited barking of Lucky. Here, every blue trace represents a “Woof” sound that Lucky makes.
Figure 15: Excited Barking 1. Figure 16: Excited Barking 2. Figure 17: Excited Barking 3.
34
4. Conclusion and Evaluation
In the first part of this Extended Essay, I explored the concepts of Fourier Series
and Fourier Transform in order to comprehend the fundamental mathematics behind
them and use it in my MATLAB code later on. In the second part, I applied my
knowledge to some real-life recordings of my own dog. After my analysis, it was found
that barks held certain patterns in their frequencies that reflected the present
motivational changes of the dog. In distressed barking type, sounds were high-pitched,
and their frequencies were cumulated around 800 Hz. Furthermore, in angry barking
type, sounds were low-pitched, and their frequencies were cumulated around 500 Hz.
Lastly, in excited barking type, sounds were neither high-pitched or low-pitched, and
their frequencies were cumulated around 600 Hz.
Although there was a distinction between the recordings of barks, there were
some weaknesses in my study, first one being the limitations in the experimental
method. As I mentioned before, I didn’t provoke Lucky to bark in a way, rather, I
recorded his barks when they occurred naturally. Hence, the time I recorded each of
them was different. This caused me to vary the distance between my microphone and
Lucky, which lead to different amplitude results in each recording. However, this didn’t
prevent me to continue my research, as I was investigating frequencies of the
recordings. Secondly, I believe that my results are too narrowed to be generalized for
any kind of wider dog population, since I only investigated the barks of my own dog,
who has certain particular characteristics as his gender, his age, his breed and etc.
Lastly, after my research, I came to a conclusion that Fourier Analysis alone might not
be sufficient to clearly distinguish between a dog’s motivational changes, since results
for angry and excited barks were relatively close. Hence, in future studies, other
characteristic of sounds can be investigated, such as time intervals between the end
35
of each bark to the start of the next one, or the time that it takes for an individual bark
to be complete. Considering these, I believe that this study can be extended in future.
The Fourier Transform code in MATLAB can be turned into an Artificial Intelligence
based algorithm. With machine learning, this AI program can learn and adapt itself to
new recordings of dog barks and can detect certain patterns between them without
human intervention, which would be much more efficient.
5. Bibliography
262588213843476. “Plotting the Signal and Fourier Transform in Matlab.” Gist,
gist.github.com/pbianche/2584364. Accessed 11 January 2021.
blackpenredpen. “Fourier Series Coefficients.” YouTube, 4 Jan. 2019,
youtu.be/iSw2xFhMRN0. Accessed 9 September 2020.
Das, Kaushik & Ghosh, Amitava & Basu, Debashis & Miller, Larry. (2014). Soil
Structure and Fluid Interaction Assessment of New Modular Reactor: Part 1 —
Numerical Simulation of Fluid Motion due to Seismic Waves. ASME 2014 Small
Modular Reactors Symposium, SMR 2014. 10.1115/SMR2014-3319. Accessed
10 October 2020.
Definition of Fourier Series and Typical Examples. Math24, 26 Apr. 2020,
www.math24.net/fourier-series-definition-typical-examples/#example2.
Accessed 9 September 2020.
Electrical Waveforms and Electrical Signals. Basic Electronics Tutorials, 26 Apr. 2020,
www.electronics-tutorials.ws/waveforms/waveforms.html. Accessed 9
September 2020.
36
Fourier Series. Math Is Fun, www.mathsisfun.com/calculus/fourier-series.html.
Accessed 9 September 2020.
Home En. FFT, www.nti-audio.com/en/support/know-how/fast-fourier-transform-fft.
Accessed 10 October 2020.
Physics and Math Lectures. Deriving the Fourier Transform From Fourier Series.
YouTube, 2 July 2020, www.youtube.com/watch?v=wmUdNKLrWeo. Accessed
20 December 2020.
Viktor Lavrenko. “IAML2.19: Representing music with Fourier coefficients”. Online
video clip. YouTube. YouTube, 10 September 2015. Accessed 9 September
2020.
Which Emotions Do Dogs Actually Experience? Modern Dog Magazine,
moderndogmagazine.com/articles/which-emotions-do-dogs-actually-
experience/32883. Acessed 11 January 2021.
All graphs were created in Desmos (https://www.desmos.com/) unless otherwise cited.
6. Appendices
Appendix A
Expressing Products of Cosines in Terms of Cosine
𝑐𝑜𝑠(𝑛𝑥)𝑐𝑜𝑠(𝑚𝑥) =
1
2
[𝑐𝑜𝑠((𝑛 − 𝑚)𝑥) + 𝑐𝑜𝑠((𝑚 + 𝑛)𝑥)]
Appendix B
Expressing Products of Sines in Terms of Cosine
𝑠𝑖𝑛(𝑛𝑥)𝑠𝑖𝑛(𝑚𝑥) =
1
2
[𝑐𝑜𝑠((𝑛 − 𝑚)𝑥) − 𝑐𝑜𝑠((𝑚 + 𝑛)𝑥)]
37
Appendix C
Expressing Products of Sines and Cosines in Terms of Sine
𝑠𝑖𝑛(𝑛𝑥)𝑐𝑜𝑠(𝑚𝑥) =
1
2
f𝑠𝑖𝑛z(𝑛 + 𝑚)𝑥{ + 𝑠𝑖𝑛z(𝑛 − 𝑚)𝑥{g
Appendix D
Expressing Products of Cosines and Sines in Terms of Sine
𝑐𝑜𝑠(𝑛𝑥)𝑠𝑖𝑛(𝑚𝑥) =
1
2
[𝑠𝑖𝑛((𝑛 + 𝑚)𝑥) − 𝑠𝑖𝑛((𝑛 − 𝑚)𝑥)]

More Related Content

Similar to IB Mathematics Extended Essay Decoding Dogs Barks With Fourier Analysis - Grade Received B

REPORT SUMMARYVibration refers to a mechanical.docx
REPORT SUMMARYVibration refers to a mechanical.docxREPORT SUMMARYVibration refers to a mechanical.docx
REPORT SUMMARYVibration refers to a mechanical.docx
debishakespeare
 
11 - 3 Experiment 11 Simple Harmonic Motio.docx
11  -  3       Experiment 11 Simple Harmonic Motio.docx11  -  3       Experiment 11 Simple Harmonic Motio.docx
11 - 3 Experiment 11 Simple Harmonic Motio.docx
tarifarmarie
 
Abstract Today’s experiment objectives are to determine the st.docx
Abstract Today’s experiment objectives are to determine the st.docxAbstract Today’s experiment objectives are to determine the st.docx
Abstract Today’s experiment objectives are to determine the st.docx
annetnash8266
 
Fibonacci_Hubble
Fibonacci_HubbleFibonacci_Hubble
Fibonacci_Hubble
Marc King
 

Similar to IB Mathematics Extended Essay Decoding Dogs Barks With Fourier Analysis - Grade Received B (20)

REPORT SUMMARYVibration refers to a mechanical.docx
REPORT SUMMARYVibration refers to a mechanical.docxREPORT SUMMARYVibration refers to a mechanical.docx
REPORT SUMMARYVibration refers to a mechanical.docx
 
Infinite series
Infinite seriesInfinite series
Infinite series
 
Mba Ebooks ! Edhole
Mba Ebooks ! EdholeMba Ebooks ! Edhole
Mba Ebooks ! Edhole
 
321 notes
321 notes321 notes
321 notes
 
Mba Ebooks ! Edhole
Mba Ebooks ! EdholeMba Ebooks ! Edhole
Mba Ebooks ! Edhole
 
Simulation of Simple Pendulum
Simulation of Simple PendulumSimulation of Simple Pendulum
Simulation of Simple Pendulum
 
Fourier Series for Continuous Time & Discrete Time Signals
Fourier Series for Continuous Time & Discrete Time SignalsFourier Series for Continuous Time & Discrete Time Signals
Fourier Series for Continuous Time & Discrete Time Signals
 
Simulation of Double Pendulum
Simulation of Double PendulumSimulation of Double Pendulum
Simulation of Double Pendulum
 
11 - 3 Experiment 11 Simple Harmonic Motio.docx
11  -  3       Experiment 11 Simple Harmonic Motio.docx11  -  3       Experiment 11 Simple Harmonic Motio.docx
11 - 3 Experiment 11 Simple Harmonic Motio.docx
 
Ch1 representation of signal pg 130
Ch1 representation of signal pg 130Ch1 representation of signal pg 130
Ch1 representation of signal pg 130
 
Stephy index page no 1 to 25 2
Stephy  index page no 1 to 25 2Stephy  index page no 1 to 25 2
Stephy index page no 1 to 25 2
 
Fourier series and fourier integral
Fourier series and fourier integralFourier series and fourier integral
Fourier series and fourier integral
 
Algebra 2 unit 9.4.9.5
Algebra 2 unit 9.4.9.5Algebra 2 unit 9.4.9.5
Algebra 2 unit 9.4.9.5
 
1_PHYSICAL Quantities to define the laws of physics
1_PHYSICAL Quantities to define the laws of physics1_PHYSICAL Quantities to define the laws of physics
1_PHYSICAL Quantities to define the laws of physics
 
Mathematical blog #1
Mathematical blog #1Mathematical blog #1
Mathematical blog #1
 
Abstract Today’s experiment objectives are to determine the st.docx
Abstract Today’s experiment objectives are to determine the st.docxAbstract Today’s experiment objectives are to determine the st.docx
Abstract Today’s experiment objectives are to determine the st.docx
 
Fibonacci_Hubble
Fibonacci_HubbleFibonacci_Hubble
Fibonacci_Hubble
 
lecture01-2functions-230830145652-a15c1554.pptx
lecture01-2functions-230830145652-a15c1554.pptxlecture01-2functions-230830145652-a15c1554.pptx
lecture01-2functions-230830145652-a15c1554.pptx
 
Free vibrations
Free vibrationsFree vibrations
Free vibrations
 
Longitudinal
LongitudinalLongitudinal
Longitudinal
 

More from Kimberly Williams

More from Kimberly Williams (20)

023 Essay Example About Self ~ Thatsnotus
023 Essay Example About Self ~ Thatsnotus023 Essay Example About Self ~ Thatsnotus
023 Essay Example About Self ~ Thatsnotus
 
Gradient Paper Candy Color Writing Envelope Paper G
Gradient Paper Candy Color Writing Envelope Paper GGradient Paper Candy Color Writing Envelope Paper G
Gradient Paper Candy Color Writing Envelope Paper G
 
STAR BOARDER Writing Paper Printable Stationery,
STAR BOARDER Writing Paper Printable Stationery,STAR BOARDER Writing Paper Printable Stationery,
STAR BOARDER Writing Paper Printable Stationery,
 
Pin By Kristina Brightman On Writ
Pin By Kristina Brightman On WritPin By Kristina Brightman On Writ
Pin By Kristina Brightman On Writ
 
Free Online Printable Lined Paper - Disco
Free Online Printable Lined Paper - DiscoFree Online Printable Lined Paper - Disco
Free Online Printable Lined Paper - Disco
 
Huxlow Ofsted Report For Primary
Huxlow Ofsted Report For PrimaryHuxlow Ofsted Report For Primary
Huxlow Ofsted Report For Primary
 
How To Write A Research Paper Introduction - YouTu
How To Write A Research Paper Introduction - YouTuHow To Write A Research Paper Introduction - YouTu
How To Write A Research Paper Introduction - YouTu
 
Pin On Amazing Templates
Pin On Amazing TemplatesPin On Amazing Templates
Pin On Amazing Templates
 
Persuasive Essay Against School Uniforms Introductio
Persuasive Essay Against School Uniforms IntroductioPersuasive Essay Against School Uniforms Introductio
Persuasive Essay Against School Uniforms Introductio
 
Cheap Assignment Help Uk - Courseworkpaperboy.Web.F
Cheap Assignment Help Uk - Courseworkpaperboy.Web.FCheap Assignment Help Uk - Courseworkpaperboy.Web.F
Cheap Assignment Help Uk - Courseworkpaperboy.Web.F
 
Dialogue Writing Essay
Dialogue Writing EssayDialogue Writing Essay
Dialogue Writing Essay
 
Summer Scholarship Essay For High School Student
Summer Scholarship Essay For High School StudentSummer Scholarship Essay For High School Student
Summer Scholarship Essay For High School Student
 
009 How To Write Scholarship Essays Essay
009 How To Write Scholarship Essays Essay009 How To Write Scholarship Essays Essay
009 How To Write Scholarship Essays Essay
 
Writing Paper Easter Egg
Writing Paper Easter EggWriting Paper Easter Egg
Writing Paper Easter Egg
 
College Essay Themes
College Essay ThemesCollege Essay Themes
College Essay Themes
 
Introduction To College Essay
Introduction To College EssayIntroduction To College Essay
Introduction To College Essay
 
Farm Writing Paper
Farm Writing PaperFarm Writing Paper
Farm Writing Paper
 
Research Paper Writing
Research Paper WritingResearch Paper Writing
Research Paper Writing
 
Cause And Effect College Essay
Cause And Effect College EssayCause And Effect College Essay
Cause And Effect College Essay
 
How Write A Research Paper
How Write A Research PaperHow Write A Research Paper
How Write A Research Paper
 

Recently uploaded

The basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxThe basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptx
heathfieldcps1
 

Recently uploaded (20)

Understanding Accommodations and Modifications
Understanding  Accommodations and ModificationsUnderstanding  Accommodations and Modifications
Understanding Accommodations and Modifications
 
How to Add New Custom Addons Path in Odoo 17
How to Add New Custom Addons Path in Odoo 17How to Add New Custom Addons Path in Odoo 17
How to Add New Custom Addons Path in Odoo 17
 
How to setup Pycharm environment for Odoo 17.pptx
How to setup Pycharm environment for Odoo 17.pptxHow to setup Pycharm environment for Odoo 17.pptx
How to setup Pycharm environment for Odoo 17.pptx
 
Google Gemini An AI Revolution in Education.pptx
Google Gemini An AI Revolution in Education.pptxGoogle Gemini An AI Revolution in Education.pptx
Google Gemini An AI Revolution in Education.pptx
 
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptxBasic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
 
Python Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docxPython Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docx
 
REMIFENTANIL: An Ultra short acting opioid.pptx
REMIFENTANIL: An Ultra short acting opioid.pptxREMIFENTANIL: An Ultra short acting opioid.pptx
REMIFENTANIL: An Ultra short acting opioid.pptx
 
Fostering Friendships - Enhancing Social Bonds in the Classroom
Fostering Friendships - Enhancing Social Bonds  in the ClassroomFostering Friendships - Enhancing Social Bonds  in the Classroom
Fostering Friendships - Enhancing Social Bonds in the Classroom
 
80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...
80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...
80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...
 
HMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptx
HMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptxHMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptx
HMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptx
 
The basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxThe basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptx
 
Exploring_the_Narrative_Style_of_Amitav_Ghoshs_Gun_Island.pptx
Exploring_the_Narrative_Style_of_Amitav_Ghoshs_Gun_Island.pptxExploring_the_Narrative_Style_of_Amitav_Ghoshs_Gun_Island.pptx
Exploring_the_Narrative_Style_of_Amitav_Ghoshs_Gun_Island.pptx
 
ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.
 
COMMUNICATING NEGATIVE NEWS - APPROACHES .pptx
COMMUNICATING NEGATIVE NEWS - APPROACHES .pptxCOMMUNICATING NEGATIVE NEWS - APPROACHES .pptx
COMMUNICATING NEGATIVE NEWS - APPROACHES .pptx
 
Single or Multiple melodic lines structure
Single or Multiple melodic lines structureSingle or Multiple melodic lines structure
Single or Multiple melodic lines structure
 
Graduate Outcomes Presentation Slides - English
Graduate Outcomes Presentation Slides - EnglishGraduate Outcomes Presentation Slides - English
Graduate Outcomes Presentation Slides - English
 
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdfUGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
 
How to Create and Manage Wizard in Odoo 17
How to Create and Manage Wizard in Odoo 17How to Create and Manage Wizard in Odoo 17
How to Create and Manage Wizard in Odoo 17
 
How to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POSHow to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POS
 
Food safety_Challenges food safety laboratories_.pdf
Food safety_Challenges food safety laboratories_.pdfFood safety_Challenges food safety laboratories_.pdf
Food safety_Challenges food safety laboratories_.pdf
 

IB Mathematics Extended Essay Decoding Dogs Barks With Fourier Analysis - Grade Received B

  • 1. IB Subject: Mathematics AA HL Extended Essay Title: Decoding Dogs’ Barks with Fourier Analysis Research Question: How can Fourier Analysis be used to differentiate between the motivational changes of a dog by examining the recordings of the dog’s barks? Word Count: 3990
  • 2. 2 Table of Contents 1. Introduction 3 2. Fourier Analysis 4 2.1 Waveforms 4 2.2 Graphical Demonstrations of Waveforms 6 2.3 Fourier Series 10 2.4 Finding the Formulas for the Fourier Coefficients 11 2.5 Example of Fourier Series Calculated Algebraically 19 2.6 Complex Form of Fourier Series 20 2.7 Transitioning from Fourier Series to Fourier Transform 25 3. Application to Dog Barks 27 3.1 Method 27 3.2 Assumptions 28 3.3 Experimentation 30 3.3.1 Distress 31 3.3.2 Anger 32 3.3.3 Excitement 33 4. Conclusion and Evaluation 34 5. Bibliography 35 6. Appendices 36
  • 3. 3 1. Introduction I grew up with my golden retriever Lucky. Throughout his life, I considered him as my best friend. For this reason, trying to understand his emotions has a great significance for me. I always wished to have a platform that could translate his barking into a language that I could understand. However, I didn’t have any idea on how such a platform could even be built. How could someone even begin translating barks into a comprehensible language for humans? A few years ago, I realized that Lucky’s barks had different acoustic patterns when he was in different situations. For example, when he saw a cat, his barks were low-pitched, thick and short. His motivational changes were clearly being mirrored in his barking vocalizations. As a result, I was able to understand the situation that Lucky was in without even seeing him. As an aspiring mathematician, I speculated that these acoustic patterns might demonstrate certain mathematical patterns that could be identified, which could be a first step in decoding dogs’ language. Therefore, after my research on methods of mathematical sound analysis, I decided to conduct my essay using Fourier Analysis, which is a method of transformation that decomposes a certain non-periodic function, such as a sound wave, into a weighted sum of sines and cosines. My aim in this essay is to find a mathematical correlation between Lucky’s barks and his motivational changes through Fourier Analysis, with my research question being, how can Fourier Analysis be used to differentiate between the motivational changes of a dog by examining the recordings of the dog’s barks?
  • 4. 4 I wrote the essay in two main parts. In the first part, I’ll give a detailed explanation of Fourier Analysis. I’ll first start by introducing Fourier Series and give the definitions of it. I’ll then give an example of Fourier Series calculated algebraically. Next, I’ll explain the relationship between Fourier Series and Fourier Transform. Lastly, I’ll relate Fourier Transform back to Lucky’s barks. In the second part, I’ll apply Fourier Transform to different type of barking sounds that I recorded in different situations, meaning different motivational changes. In the end, I’ll compare the results that I found for each motivational change, and hence conclude my essay by indicating the correlation that I identified. 2. Fourier Analysis 2.1 Waveforms Waveforms are graphical representations of shapes of waves, and they portray a certain characteristic of the wave, such as variations in amplitude, as a function of time1 . A simple example of a periodic waveform can be the sine wave. 1 “Electrical Waveforms and Electrical Signals.” Basic Electronics Tutorials, 26 Apr. 2020, www.electronics-tutorials.ws/waveforms/waveforms.html. Graph 1: The amplitude (y-axis) of the waveform is graphed with respect to time (x-axis).
  • 5. 5 However, sometimes waveforms might not be as simple as the sine wave. For example, graph below shows the variations in amplitude of a seismic wave with respect to time. 2 As it is seen, it will be difficult to perform calculations with the waveform above, and it will be insufficient since it only gives an idea for variations in amplitude. Therefore, it will not always be useful to think waveforms in time domain. In fact, regardless of how complex a waveform might be, all waveforms in the universe are composed of sinusoidal functions of different frequencies, and hence can be written as the sum of those functions. Thus, instead of plotting a seemingly complicated waveform as a function of time, we can transform it from the time domain into the frequency domain, in which frequency is independent variable instead of time. 3 2 Das, Kaushik & Ghosh, Amitava & Basu, Debashis & Miller, Larry. (2014). Soil Structure and Fluid Interaction Assessment of New Modular Reactor: Part 1 — Numerical Simulation of Fluid Motion due to Seismic Waves. ASME 2014 Small Modular Reactors Symposium, SMR 2014. 10.1115/SMR2014- 3319. 3 “Home En.” FFT, www.nti-audio.com/en/support/know-how/fast-fourier-transform-fft Figure 1: A seismic waveform. Figure 2: Transforming a waveform from the time domain to the frequency domain.
  • 6. 6 2.2 Graphical Demonstrations of Waveforms The following examples will demonstrate how a waveform can be made up of different sinusoidal functions.4 To start with, let’s examine the function 𝑥(𝑡) below, where the y-axis indicates the amplitude, and the x-axis indicates the time. The function 𝑥(𝑡) is in fact the result of the summation of three different sinusodial functions. This was an example function that I created to show that when combined, functions with different periods and amplitudes can produce a rather complicated function. The first component of the function is a sine wave with the equation 𝑦 = 𝑠𝑖𝑛(2𝜋𝑡), meaning an amplitude A = 1 and period T = 1, as represented below. 4 Demonstration inspired by: “Fourier Series.” Math Is Fun, www.mathsisfun.com/calculus/fourier- series.html. Graph 3: First frequency component Graph 4: First frequency component and x(t) Graph 2: Graph of x(t)
  • 7. 7 The second component is a cosine wave with the equation 𝑦 = ! " 𝑐𝑜𝑠 0 # $ 𝜋𝑡1, meaning an amplitude of A = ! " and a period of T = 2.5, as shown below. Similarly, the third component of 𝑥(𝑡) is again a cosine wave with the equation 𝑦 = % & 𝑐𝑜𝑠(6𝜋𝑡), meaning an amplitude, A = % & and period T = % ! , as shown in below. As a result, the 𝑥(𝑡) can be written as the sum of the three components: Graph 7: Third frequency component Graph 8: Third frequency component and x(t) Graph 5: Second frequency component Graph 6: Second frequency component and x(t)
  • 8. 8 𝑥(𝑡) = 𝑠𝑖𝑛(2𝜋𝑡) + 3 7 𝑐𝑜𝑠 6 4 5 𝜋𝑡9 + 1 2 𝑐𝑜𝑠(6𝜋𝑡) While 𝑥(𝑡) is a made-up function, all waveforms can be decomposed into such sinusodial functions. However, the number of sines and cosines that are going to be summed up is not limited. Conversely, we can add infinite number of sines and cosines to form a waveform. The following periodic function, the square wave, is a simple example of this situation. The square wave is composed of infinitely many sine waves of different frequencies. The first component of the square wave can be a simple sine wave, for example 𝑦 = 𝑠𝑖𝑛(𝜋𝑡), meaning an amplitude of A = 1 and period of T = 2. Graph 10: Graph of 𝑦 = 𝑠𝑖𝑛(𝜋𝑡) Graph 9: A square wave
  • 9. 9 Then, we can add another sine wave with one third of amplitude and three times the frequency, so the resultant function becomes: We can add another layer of sine wave on top of the previous sum, but this time with one fifth the amplitude and five times the frequency. It is clearly seen that as we keep adding new sine waves with this odd number pattern, meaning with amplitudes % &'(% times and frequencies 2𝑛 + 1, 𝑛 ∈ ℕ times the first component, then the “humps” (shown below) will get smaller and smaller. Graph 11: Graph of 𝑦 = 𝑠𝑖𝑛(𝜋𝑡) + ! " 𝑠𝑖𝑛(3𝜋𝑡) Graph 12: Graph of 𝑦 = 𝑠𝑖𝑛(𝜋𝑡) + ! " 𝑠𝑖𝑛(3𝜋𝑡) + ! # 𝑠𝑖𝑛(5𝜋𝑡)
  • 10. 10 If we add infinite amount of sine waves together, the “humps” will look like a straight line, and the square wave, shown in Graph 9, will form. 2.3 Fourier Series The square wave is a certain example, but there are many other periodic waveforms that can be written as the sum of infinitely many sines and cosines. Hence, we can deduce a formula that generalizes the equation of a periodic waveform as follows: Let 𝑓(𝑥) be a periodic function of time defined on the interval [−𝜋, 𝜋], where the function’s period is 2𝜋. Then, 𝑓(𝑥) can be found with the following formula: 𝑓(𝑥) = 𝑎) + @[𝑎'𝑠𝑖𝑛(𝑛𝑥)] + @[𝑏'𝑐𝑜𝑠(𝑛𝑥)] * '+% * '+% Where n is a positive integer. In fact, this formula is called the Fourier Series. 𝑓(𝑥) is the function whose Fourier Series we want to calculate, and the right side of the formula is its Fourier Series. Moreover, in this formula, 𝑎), 𝑎', and 𝑏' are called the Fourier Coefficients, and obtaining the Fourier Series of a function means These “humps” will get smaller each time we add a new term. Graph 13: Graph of 𝑦 = 𝑠𝑖𝑛(𝜋𝑡) + ! " 𝑠𝑖𝑛(3𝜋𝑡) + ! # 𝑠𝑖𝑛(5𝜋𝑡) + ! $ 𝑠𝑖𝑛(7𝜋𝑡) + ! % 𝑠𝑖𝑛(9𝜋𝑡) + ! !! 𝑠𝑖𝑛(11𝜋𝑡) + ! !" 𝑠𝑖𝑛(13𝜋𝑡) + ! !# 𝑠𝑖𝑛(15𝜋𝑡) (1)
  • 11. 11 calculating the values of these coefficients. Each of these coefficients can be calculated with their own unique formulas: 𝑎) = 1 2𝜋 D 𝑓(𝑥)𝑑𝑥 , -, 𝑎' = 1 𝜋 D 𝑓(𝑥)𝑠𝑖𝑛(𝑛𝑥)𝑑𝑥 , -, 𝑏' = 1 𝜋 D 𝑓(𝑥)𝑐𝑜𝑠(𝑛𝑥)𝑑𝑥 , -, 2.4 Finding the Formulas for the Fourier Coefficients In the section below, I will show how the formulas above are obtained 5 . First, we are going to find the formula for 𝑎). Let’s integrate both sides in the formula (1). D 𝑓(𝑥)𝑑𝑥 , -, = D 𝑎) , -, 𝑑𝑥 + D @[𝑎'𝑠𝑖𝑛(𝑛𝑥)] * '+% , -, 𝑑𝑥 + D @[𝑏'𝑐𝑜𝑠(𝑛𝑥)] * '+% , -, 𝑑𝑥 The key here is the interval that we are integrating the functions over. Since sine and cosine functions are periodic, it will be sufficient to define the integral over the interval [−𝜋, 𝜋], and it will be much easier for the calculations. Next, we can take the coefficients out of the integral: D 𝑓(𝑥)𝑑𝑥 , -, = 𝑎) D 𝑑𝑥 , -, + @ 𝑎' * '+% D 𝑠𝑖𝑛(𝑛𝑥) , -, 𝑑𝑥 + @ 𝑏' * '+% D 𝑐𝑜𝑠(𝑛𝑥) , -, 𝑑𝑥 5 Derivation adapted from: blackpenredpen. “Fourier Series Coefficients.” YouTube, 4 Jan. 2019, youtu.be/iSw2xFhMRN0.
  • 12. 12 Now, we will calculate the values of ∫ 𝑠𝑖𝑛(𝑛𝑥) , -, 𝑑𝑥 and ∫ 𝑐𝑜𝑠(𝑛𝑥) , -, 𝑑𝑥. D 𝑠𝑖𝑛(𝑛𝑥) , -, 𝑑𝑥 = − 1 𝑛 𝑐𝑜𝑠(𝑛𝑥)G = − 1 𝑛 𝑐𝑜𝑠(𝑛𝜋) + 1 𝑛 𝑐𝑜𝑠(−𝑛𝜋) This will always be 0, as when n is an even number both 𝑐𝑜𝑠(𝑛𝜋) and 𝑐𝑜𝑠(−𝑛𝜋) will be 1 and hence they will cancel out each other. Similarly, when n is an odd number, both 𝑐𝑜𝑠(𝑛𝜋) and 𝑐𝑜𝑠(−𝑛𝜋) will be -1 and they will cancel out each other. Similarly: D 𝑐𝑜𝑠(𝑛𝑥) , -, 𝑑𝑥 = 1 𝑛 𝑠𝑖𝑛(𝑛𝑥)G = 1 𝑛 𝑠𝑖𝑛(𝑛𝜋) − 1 𝑛 𝑠𝑖𝑛(−𝑛𝜋) This expression will also be 0, as the sine of any multiple of 𝜋 is 0. Hence, we can rewrite the above equation as: D 𝑓(𝑥)𝑑𝑥 , -, = 𝑎) D 𝑑𝑥 , -, D 𝑓(𝑥)𝑑𝑥 , -, = 2𝜋𝑎) 𝒂𝟎 = 𝟏 𝟐𝝅 D 𝒇(𝒙)𝒅𝒙 𝝅 -𝝅 . Therefore, 𝑎) can also be seen as the average value of 𝑓(𝑥) over an entire period. Secondly, we fill find the formula for 𝑏'. Let’s rewrite the formula (1). 𝑓(𝑥) = 𝑎) + @[𝑎'𝑠𝑖𝑛(𝑛𝑥)] + @[𝑏'𝑐𝑜𝑠(𝑛𝑥)] * '+% * '+% 𝜋 −𝜋 𝜋 −𝜋 (2) (3)
  • 13. 13 Then, we are going to multiply each term by 𝑐𝑜𝑠(𝑚𝑥)𝑑𝑥, (m is a positive integer) to help us convert the expression into the formula for 𝑏'. and integrate both sides. D 𝑓(𝑥)𝑐𝑜𝑠(𝑚𝑥)𝑑𝑥 , -, = D 𝑎) , -, 𝑐𝑜𝑠(𝑚𝑥)𝑑𝑥 + D @[𝑎'𝑠𝑖𝑛(𝑛𝑥)𝑐𝑜𝑠(𝑚𝑥)] * '+% , -, 𝑑𝑥 + D @[𝑏'𝑐𝑜𝑠(𝑛𝑥)𝑐𝑜𝑠(𝑚𝑥)] * '+% , -, 𝑑𝑥 We can take the coefficients out of the integral: D 𝑓(𝑥)𝑐𝑜𝑠(𝑚𝑥)𝑑𝑥 , -, = 𝑎) D 𝑐𝑜𝑠(𝑚𝑥)𝑑𝑥 , -, + @ 𝑎' * '+% D 𝑠𝑖𝑛(𝑛𝑥)𝑐𝑜𝑠(𝑚𝑥) , -, 𝑑𝑥 + @ 𝑏' * '+% D 𝑐𝑜𝑠(𝑛𝑥) , -, 𝑐𝑜𝑠(𝑚𝑥)𝑑𝑥 We know that ∫ 𝑐𝑜𝑠(𝑚𝑥)𝑑𝑥 , -, is 0 from our previous calculations on expression (3). Hence, we have to calculate ∫ 𝑠𝑖𝑛(𝑛𝑥)𝑐𝑜𝑠(𝑚𝑥) , -, 𝑑𝑥. From the trigonometric identity in Appendix C, we can rewrite the integral as: D 1 2 [𝑠𝑖𝑛((𝑛 + 𝑚)𝑥) + 𝑠𝑖𝑛((𝑛 − 𝑚)𝑥)] , -, 𝑑𝑥 = 1 2 D 𝑠𝑖𝑛((𝑛 + 𝑚)𝑥)𝑑𝑥 , -, + 1 2 D 𝑠𝑖𝑛((𝑛 − 𝑚)𝑥)𝑑𝑥 , -, (4)
  • 14. 14 If 𝑛 ≠ 𝑚, then (n+m) and (n-m) will be non-zero integers. Hence, we know from the calculation of the expressions (2), the definite integrals of ∫ 𝑠𝑖𝑛(𝑛𝑥) , -, 𝑑𝑥 when n is a non-zero integer is going to be 0. If 𝑛 = 𝑚, ∫ 𝑠𝑖𝑛((𝑛 + 𝑚)𝑥) , -, 𝑑𝑥 will still be 0, as (m+n) is still going to be a non-zero integer. Moreover, (n-m) will be 0, and so % & ∫ 𝑠𝑖𝑛((𝑛 − 𝑚)𝑥) , -, 𝑑𝑥 will be 0. In either case, ∫ 𝑠𝑖𝑛(𝑛𝑥)𝑐𝑜𝑠(𝑚𝑥) , -, 𝑑𝑥 will be 0. Hence, equation (4) can be rewritten as: D 𝑓(𝑥)𝑐𝑜𝑠(𝑚𝑥)𝑑𝑥 , -, = @ 𝑏' * '+% D 𝑐𝑜𝑠(𝑛𝑥) , -, 𝑐𝑜𝑠(𝑚𝑥)𝑑𝑥 Now, we have to calculate ∫ 𝑐𝑜𝑠(𝑛𝑥) , -, 𝑐𝑜𝑠(𝑚𝑥)𝑑𝑥. From the trigonometric identity in Appendix A, we can rewrite the integral as: D 1 2 [𝑐𝑜𝑠((𝑛 − 𝑚)𝑥) + 𝑐𝑜𝑠((𝑚 + 𝑛)𝑥)] , -, 𝑑𝑥 = 1 2 D 𝑐𝑜𝑠((𝑛 − 𝑚)𝑥)𝑑𝑥 , -, + 1 2 D 𝑐𝑜𝑠((𝑛 + 𝑚)𝑥)𝑑𝑥 , -, If 𝑛 ≠ 𝑚, then (n-m) and (n+m) will be non-zero integers. Hence, we know from the calculation of the expression (3), the definite integral of ∫ 𝑐𝑜𝑠(𝑚𝑥)𝑑𝑥 , -, when m is a non-zero integer is going to be 0. Hence, the expression ∫ 𝑐𝑜𝑠(𝑛𝑥) , -, 𝑐𝑜𝑠(𝑚𝑥)𝑑𝑥 will be 0. (5)
  • 15. 15 If 𝑛 = 𝑚, ∫ 𝑐𝑜𝑠((𝑚 + 𝑛)𝑥)] , -, 𝑑𝑥 will still be 0, as (m+n) is still going to be a non-zero integer. Moreover, (n-m) will be 0, and % & ∫ [𝑐𝑜𝑠((𝑛 − 𝑚)𝑥)𝑑𝑥 , -, will be rewritten as: 1 2 D 1𝑑𝑥 , -, = 1 2 (𝑥)| = 𝜋 2 − −𝜋 2 = 2𝜋 2 = 𝜋 Since the Sigma Notation runs over all possible n, at some point, n will be m. Therefore, the right-hand side of the equation (5) will be 𝜋𝑏0. Hence: D 𝑓(𝑥)𝑐𝑜𝑠(𝑚𝑥)𝑑𝑥 , -, = 𝜋𝑏0 𝑏0 = 1 𝜋 D 𝑓(𝑥)𝑐𝑜𝑠(𝑚𝑥)𝑑𝑥 , -, We can relabel the m as n: 𝒃𝒏 = 𝟏 𝝅 D 𝒇(𝒙)𝒄𝒐𝒔(𝒏𝒙)𝒅𝒙. 𝝅 -𝝅 Similarly, we can find the formula for 𝑎'. First, we are going to multiply each term in formula (1) with 𝑠𝑖𝑛(𝑚𝑥)𝑑𝑥 and then will integrate both sides. D 𝑓(𝑥)𝑠𝑖𝑛(𝑚𝑥)𝑑𝑥 , -, = D 𝑎) , -, 𝑠𝑖𝑛(𝑚𝑥)𝑑𝑥 + D @[𝑎'𝑠𝑖𝑛(𝑛𝑥)𝑠𝑖𝑛(𝑚𝑥)] * '+% , -, 𝑑𝑥 + D @[𝑏'𝑐𝑜𝑠(𝑛𝑥)𝑠𝑖𝑛(𝑚𝑥)] * '+% , -, 𝑑𝑥 𝜋 −𝜋
  • 16. 16 We can take the coefficients out of the integral: D 𝑓(𝑥)𝑠𝑖𝑛(𝑚𝑥)𝑑𝑥 , -, = 𝑎) D 𝑠𝑖𝑛(𝑚𝑥)𝑑𝑥 , -, + @ 𝑎' * '+% D 𝑠𝑖𝑛(𝑛𝑥)𝑠𝑖𝑛(𝑚𝑥) , -, 𝑑𝑥 + @ 𝑏' * '+% D 𝑐𝑜𝑠(𝑛𝑥) , -, 𝑠𝑖𝑛(𝑚𝑥)𝑑𝑥 We know that ∫ 𝑠𝑖𝑛(𝑚𝑥)𝑑𝑥 , -, is 0 from our previous calculations on expression (2). Hence, we have to calculate ∫ 𝑐𝑜𝑠(𝑛𝑥) , -, 𝑠𝑖𝑛(𝑚𝑥)𝑑𝑥. From the trigonometric identity in Appendix D, we can rewrite the integral as: D 1 2 [𝑠𝑖𝑛((𝑛 + 𝑚)𝑥) − 𝑠𝑖𝑛((𝑛 − 𝑚)𝑥)] , -, 𝑑𝑥 = 1 2 D 𝑠𝑖𝑛((𝑛 + 𝑚)𝑥)𝑑𝑥 , -, − 1 2 D 𝑠𝑖𝑛((𝑛 − 𝑚)𝑥)𝑑𝑥 , -, If 𝑛 ≠ 𝑚, then (n+m) and (n-m) will be non-zero integers. Hence, we know from the calculation of the expressions (2), the definite integrals of ∫ 𝑠𝑖𝑛(𝑛𝑥) , -, 𝑑𝑥 when n is a non-zero integer is going to be 0. If 𝑛 = 𝑚, ∫ 𝑠𝑖𝑛((𝑛 + 𝑚)𝑥) , -, 𝑑𝑥 will still be 0, as (m+n) is still going to be a non-zero integer. Moreover, (n-m) will be 0, and so % & ∫ 𝑠𝑖𝑛((𝑛 − 𝑚)𝑥) , -, 𝑑𝑥 will be 0. In either case, ∫ 𝑐𝑜𝑠(𝑛𝑥) , -, 𝑠𝑖𝑛(𝑚𝑥)𝑑𝑥 will be 0. Hence, equation (6) can be rewritten as: (6)
  • 17. 17 D 𝑓(𝑥)𝑠𝑖𝑛(𝑚𝑥)𝑑𝑥 , -, = @ 𝑎' * '+% D 𝑠𝑖𝑛(𝑛𝑥) , -, 𝑠𝑖𝑛(𝑚𝑥)𝑑𝑥 Now, we have to calculate ∫ 𝑠𝑖𝑛(𝑛𝑥) , -, 𝑠𝑖𝑛(𝑚𝑥)𝑑𝑥. From the trigonometric identity in Appendix B, we can rewrite the integral as: D 1 2 [𝑐𝑜𝑠((𝑛 − 𝑚)𝑥) − 𝑐𝑜𝑠((𝑚 + 𝑛)𝑥)] , -, 𝑑𝑥 = 1 2 D 𝑐𝑜𝑠((𝑛 − 𝑚)𝑥)𝑑𝑥 , -, − 1 2 D 𝑐𝑜𝑠((𝑚 + 𝑛)𝑥)𝑑𝑥 , -, If 𝑛 ≠ 𝑚, then (n-m) and (n+m) will be non-zero integers. Hence, we know from the calculation of the expression (3), the definite integral of ∫ 𝑐𝑜𝑠(𝑚𝑥)𝑑𝑥 , -, when m is a non-zero integer is going to be 0. Hence, the expression ∫ 𝑠𝑖𝑛(𝑛𝑥) , -, 𝑠𝑖𝑛(𝑚𝑥)𝑑𝑥 will be equal to 0. If 𝑛 = 𝑚, ∫ 𝑐𝑜𝑠((𝑚 + 𝑛)𝑥)] , -, 𝑑𝑥 will still be 0, as (m+n) is still going to be a non-zero integer. Moreover, (n-m) will be 0, and % & ∫ [𝑐𝑜𝑠((𝑛 − 𝑚)𝑥)𝑑𝑥 , -, will be rewritten as: 1 2 D 1𝑑𝑥 , -, = 1 2 (𝑥)| = 𝜋 2 − −𝜋 2 = 2𝜋 2 = 𝜋 Since the Sigma Notation runs over all possible n, at some point, n will be m. Therefore, the right-hand side of equation (7) will be 𝜋𝑎0. Hence: 𝜋 −𝜋 (7)
  • 18. 18 D 𝑓(𝑥)𝑠𝑖𝑛(𝑚𝑥)𝑑𝑥 , -, = 𝜋𝑎0 𝑎0 = 1 𝜋 D 𝑓(𝑥)𝑠𝑖𝑛(𝑚𝑥)𝑑𝑥 , -, We can relabel the m as n: 𝒂𝒏 = 𝟏 𝝅 D 𝒇(𝒙)𝒔𝒊𝒏(𝒏𝒙)𝒅𝒙. 𝝅 -𝝅 Using these three formulas, we can calculate the Fourier Coefficients. The value of those coefficients will inform us about the weight of each frequency in the waveform, indicating how much of which sinusodial wave should be added in order to produce the original waveform. This is illustrated in the figure below. 6 6 Viktor Lavrenko. “IAML2.19: Representing music with Fourier coefficients”. Online video clip. YouTube. YouTube, 10 September 2015. Figure 3: Taken from Viktor Lavrenko. The graph shows a simple illustration of how the Fourier Coefficients can inform us about the weight of the frequencies present in the original function.
  • 19. 19 2.5 Example of Fourier Series Calculated Algebraically In this part, I will calculate the Fourier Series of the square wave by using the Fourier Coefficients. Firstly, our square wave is going to have a period of 2𝜋, and will be defined on the interval [−𝜋, 𝜋]. The function for the wave will be as follows 7 : 𝑓(𝑥) = Y 0, −𝜋 ≤ 𝑥 ≤ 0 1, 0 < 𝑥 ≤ 𝜋 Firstly, we will calculate the coefficient 𝑎): 𝑎) = 1 2𝜋 D 𝑓(𝑥)𝑑𝑥 , -, Since between −𝜋 and 0 the function is 0, we can rewrite the integral as: 𝑎) = 1 2𝜋 D 𝑓(𝑥)𝑑𝑥 , ) = 1 2𝜋 D 1𝑑𝑥 = 1 2𝜋 ∙ 𝜋 = 1 2 , ) Next, we will find the coefficient 𝑎': 7 “Definition of Fourier Series and Typical Examples.” Math24, 26 Apr. 2020, www.math24.net/fourier- series-definition-typical-examples/#example2.
  • 20. 20 𝑎' = 1 𝜋 D 𝑓(𝑥)𝑠𝑖𝑛(𝑛𝑥)𝑑𝑥 , -, = 1 𝜋 D 𝑓(𝑥)𝑠𝑖𝑛(𝑛𝑥)𝑑𝑥 , ) = 1 𝜋 D 1𝑠𝑖𝑛(𝑛𝑥)𝑑𝑥 , ) = 1 𝜋 ^ 6 − 𝑐𝑜𝑠(𝑛𝑥) 𝑛 9G _ = − 1 𝜋𝑛 ∙ (𝑐𝑜𝑠(𝑛𝜋) − 𝑐𝑜𝑠(0)) = 1 − 𝑐𝑜𝑠(𝑛𝜋) 𝜋𝑛 Since 𝑐𝑜𝑠(𝑛𝜋) = (−1)' , the expression can turn into: 𝑎' = 1 − (−1)' 𝜋𝑛 After, we will find the coefficient 𝑏': 𝑏' = 1 𝜋 D 𝑓(𝑥)𝑐𝑜𝑠(𝑛𝑥)𝑑𝑥 , -, = 1 𝜋 D 𝑓(𝑥)𝑐𝑜𝑠(𝑛𝑥)𝑑𝑥 , ) = 1 𝜋 D 1𝑐𝑜𝑠(𝑛𝑥)𝑑𝑥 , -, = 1 𝜋 ^ 6 𝑠𝑖𝑛(𝑛𝑥) 𝑛 9G _ = 1 𝜋𝑛 ∙ 0 = 0 Hence, the Fourier Series of this square wave will be: 𝑓(𝑥) = 1 2 + @ ^ 1 − (−1)' 𝜋𝑛 𝑠𝑖𝑛(𝑛𝑥)_ * '+% 2.6 Complex Form of Fourier Series It is now possible for us to calculate the Fourier Series coefficients of any periodic function. However, there are several drawbacks of this method. Firstly, integral calculations can be relatively difficult for large numbers. Secondly, some waveforms will have infinitely many coefficients and it will be impossible to calculate them all with this approach. Therefore, using complex numbers will significantly make the calculations easier. Hence, we will now derive the complex exponential formula for Formula (1). 𝜋 0 𝜋 0
  • 21. 21 We’ll start with the Euler’s formula: 𝑒23 = 𝑐𝑜𝑠𝜃 + 𝑖𝑠𝑖𝑛 𝜃 Next, we’ll have to find the complex definitions of the sine and cosine. Let’s plug in a negative into the argument: 𝑒-23 = 𝑐𝑜𝑠𝜃 − 𝑖𝑠𝑖𝑛 𝜃 If we add these two equations together: 𝑒23 + 𝑒-23 = 2𝑐𝑜𝑠𝜃 𝑐𝑜𝑠𝜃 = 𝑒23 + 𝑒-23 2 Similarly: 𝑒23 − 𝑒-23 = 2𝑖𝑠𝑖𝑛𝜃 𝑠𝑖𝑛𝜃 = 𝑒23 + 𝑒-23 2𝑖 Substituting into the Fourier Series formula, where 𝜃 = 𝑛𝑥 (since in the formula we wrote sin(nx)):
  • 22. 22 𝑓(𝑥) = 𝑎) + @ b𝑎' c 𝑒2'4 + 𝑒-2'4 2𝑖 de + @ b𝑏' c 𝑒2'4 + 𝑒-2'4 2 de * '+% * '+% = 𝑎) + @ b𝑎' c −𝑖𝑒2'4 + 𝑖𝑒-2'4 2 de + @ b𝑏' c 𝑒2'4 + 𝑒-2'4 2 de * '+% * '+% = 𝑎) + @ ^𝑒-2'4 6 𝑏' + 𝑖𝑎' 2 9_ + @ ^ 𝑒2'4 6 𝑏' − 𝑖𝑎' 2 9_ * '+% * '+% Next, we will resubstitute coefficients: 𝑐' = 𝑏' − 𝑖𝑎' 2 𝑐-' = 𝑏' + 𝑖𝑎' 2 𝑐) = 𝑎) This substitution will factor the 𝑎) into the sum. Hence: 𝑓(𝑥) = @f𝑐-'𝑒-2'4 + 𝑐' 𝑒2'4 g * '+) The n’s on the left-hand side of the equation can be changed as -n to break the expression down to two summations: 𝑓(𝑥) = @ f𝑐'𝑒2'4 g + @f𝑐' 𝑒2'4 g * '+) ) '+-* 𝒇(𝒙) = @ [𝒄𝒏 𝒆𝒊𝒏𝒙] * 𝒏+-* (8)
  • 23. 23 Where: 𝑐' = ⎩ ⎪ ⎨ ⎪ ⎧ 𝑏' − 𝑖𝑎' 2 𝑛 > 0 𝑏-' + 𝑖𝑎-' 2 𝑛 < 0 𝑎) 𝑛 = 0 Now that we have the complex form, we can find the formula for 𝑐'. To do that, we’ll first multiply both sides of the equation by 𝑒-204 and take the integral: D 𝑓(𝑥)𝑒-204 𝑑𝑥 , -, = @ 𝑐' D 𝑒2'4 𝑒-204 𝑑𝑥 , -, * '+-* For the integral on the right-hand side, there are two possibilities: D 𝑒2'4 𝑒-204 𝑑𝑥 , -, = Y 0, 𝑛 ≠ 𝑚 2𝜋, 𝑛 = 𝑚 Since Sigma Notation runs over all possible n, at some point, n will be m Therefore, we can write the result of the integral as 2𝜋: D 𝑓(𝑥)𝑒-204 𝑑𝑥 , -, = 2𝜋 ∙ 𝑐0 We can relabel m as n: D 𝑓(𝑥)𝑒-2'4 𝑑𝑥 , -, = 2𝜋 ∙ 𝑐' 𝒄𝒏 = 𝟏 𝟐𝝅 D 𝒇(𝒙)𝒆-𝒊𝒏𝒙 𝒅𝒙 𝝅 -𝝅 (9)
  • 24. 24 An important point here is that when we first introduced formula (1), we defined the interval as [−𝜋, 𝜋] and made all of the calculations accordingly. However, not all functions have such a period. Hence, if we generalize the formulas 8 and 9, then we will be able to apply it to any other periodic function. Although dog barks are not usually periodic, generalizing the formula will help us extend our calculations to non-periodic functions, as we will see in 2.7. The generalization for Fourier Series to any periodic function is as follows: 𝑓(𝑥) = 𝑎) + @[𝑎'𝑠𝑖𝑛 0 𝑛𝜋𝑥 𝐿 1] + @[𝑏'𝑐𝑜𝑠 0 𝑛𝜋𝑥 𝐿 1] * '+% * '+% Where the period of the function is denoted by 2L. Notice that in formula (1), the period of the function was 2𝜋, so when substituted, we substituted 𝜋 for L, we were left with 𝑛𝑥. Therefore, in formulas above, plugging in ',4 7 instead of 𝑛𝑥 will help us find the generalizations of the formulas. Firstly, if we consider formula (8), and substitute ',4 7 for 𝑛𝑥, we will get the formula below, which is the generalization of the complex form of Fourier Series for any function with a period of 2L: 𝒇(𝒙) = @ ^𝒄𝒏 𝒆 𝒊𝒏𝝅𝒙 𝑳 _ * 𝒏+-* Similarly, we can generalize formula (9) as well. Not that in formula (9), the period of the function was 2𝜋, and it is written in the form of a multiplicative inverse. (10)
  • 25. 25 Hence, instead of 2𝜋, we will plug in 2𝐿, and the integral will be defined over the interval [−𝐿, 𝐿]: 𝒄𝒏 = 𝟏 𝟐𝑳 D 𝒇(𝒙)𝒆- 𝒊𝒏𝝅𝒙 𝑳 𝒅𝒙 𝑳 -𝑳 2.7 Transitioning from Fourier Series to Fourier Transform Fourier Series can be very useful to decompose a waveform, but it only works for periodic functions. However, in nature, sounds are usually not periodic. Therefore, we have to find another method that can decompose a non-periodic function. This method is called the Fourier Transform, and it has an algebraic formula, which can be derived as following 8 : Let 𝜔 = ', 7 and since n is the variable, let ∆𝜔 = , 7 : 𝑐' = 1 2𝐿 D 𝑓(𝑥)𝑒-294 𝑑𝑥 7 -7 We can define a function, 𝐹(𝛿), where 𝛿 is a variable: 𝐹(𝛿) = D 𝑓(𝑥)𝑒-2:4 𝑑𝑥 7 -7 8 Derivation adapted from: Physics and Math Lectures. Deriving the Fourier Transform From Fourier Series. YouTube, 2 July 2020, www.youtube.com/watch?v=wmUdNKLrWeo.
  • 26. 26 𝑐' = 1 2𝐿 𝐹(𝜔) Plugging to the complex form of the Fourier Series: 𝑓(𝑥) = @ ^ 1 2𝐿 𝐹(𝜔) 𝑒294 _ * '+-* Since ∆𝜔 = , 7 , % &7 will be ∆9 &, . Hence: 𝑓(𝑥) = @ ^ 1 2𝜋 𝐹(𝜔) 𝑒294 ∙ ∆𝜔_ * '+-* In fact, this expression looks much like the Sigma notation of a Reimann Sum. Moreover, since now we want to deal with non-periodic functions, we don’t need to have an interval that defines us the period of the function. Hence, instead of [−𝐿, 𝐿], we can define our interval as (−∞, ∞). Therefore, L will approach to infinity, while ∆𝜔 will keep getting smaller, approaching 0. Hence, we can convert above expression into an integral, as below: 𝒇(𝒙) = 𝟏 𝟐𝝅 D 𝑭(𝝎) * -* 𝒆𝒊𝝎𝒙 𝒅𝝎 With this formula, known as Inverse Fourier Transform, we can use a function of 𝜔, to find a function of time, 𝑓(𝑥). Similarly, we have a function of time, 𝑓(𝑥), and
  • 27. 27 we want to define it as a function of 𝜔, we will use the formula that we defined above, which is known as Fourier Transform: 𝓕{𝒇(𝒙)} = 𝑭(𝝎) = D 𝒇(𝒙)𝒆-𝒊𝝎𝒙 𝒅𝒙 * -* Therefore, since frequency is defined as % = (T = period), and since we had defined 𝜔 as ', 7 (L = half of the period), we can conclude that the domain of the function 𝐹(𝜔) will be the frequency. Thus, with Fourier Transform, we’ll be able to transform a function from time domain to frequency domain, as previously seen in Figure 2. 3. Application to Dog Barks When we have a seemingly complicated function, it can be difficult to find the result analytically. Moreover, sometimes it can be very difficult to write a waveform as a function. In such cases, we can transform them into their frequency domains computationally. In my investigation with dog barks, I’ll use the programming platform MATLAB to analyze recordings. 3.1 Method I decided to record Lucky’s barks in order to detect any patterns that might be correlated with his motivational changes. I used a program called Audacity to record, which allowed me to visually see the waveforms. After, I used MATLAB to apply Fourier Transform algorithm to recordings.
  • 28. 28 Note that I didn’t cause any harm to Lucky while my experimentation. I recorded him when he was barking for a natural cause. 3.2 Assumptions My study starts with two critical assumptions: 1) Dogs have some fundamental emotions. 2) Dogs emit acoustically different barks in different situations. The first assumption is scientifically proven. According to Stanley Coren, “Dogs have same hormones and undergo the same chemical changes that humans do during emotional states. Dogs even have the hormone oxytocin, which, in humans, is involved with feeling love and affection for others. With the same neurology and chemistry that people have, it seems reasonable to suggest that dogs also have emotions that are similar to ours.9 ” In fact, dogs possess similar emotions of a 2.5-year-old person, as seen in below: 9 “Which Emotions Do Dogs Actually Experience?” Modern Dog Magazine, moderndogmagazine.com/articles/which-emotions-do-dogs-actually-experience/32883. Figure 4: The emotional range of dogs 9 .
  • 29. 29 The second assumption will be tested with my experimentation. With Fourier Analysis, I’ll explore frequency domains of each recording and try to detect frequency changes that occur in different situations. For my study, I have determined three situations: 1) In this situation, I recorded Lucky’s barks for 1-2 mins. when my family and I were leaving our house and Lucky was going to stay alone. 2) We live in a neighborhood that is inhabited by many cats. In this situation, I recorded Lucky’s barks for 1 to 2 mins. when he saw a cat. 3) In this situation, I recorded Lucky’s barks for approximately. 1-2 mins when I took his leash and prepared to go for a walk. To distinguish these situations, I named all three situations as below: Situation 1: Distress Situation 2: Anger Situation 3: Excitement Although these emotions might not be accurate, these are only going to be used as a “label” for us to name different motivational changes of dogs. So, my intention here is to not find the real emotions that the dog feels in that situation, rather, to find what changes that acoustically occur in his barks when he’s in different situations. Therefore, the naming of emotions is not significant in my study. However, it was important to know that dogs can feel different emotions, as it suggests that they can
  • 30. 30 have different motivational changes. In my study, I did three recordings for each situation, resulting in a total of 9 recordings. 3.3 Experimentation MATLAB code that I will use to find frequency domains of my recordings is below 10 : 10 Code adapted from: 262588213843476. “Plotting the Signal and Fourier Transform in Matlab.” Gist, gist.github.com/pbianche/2584364. Figure 5: MATLAB Code
  • 31. 31 3.3.1 Distress Barks in this situation can be described as high-pitched and similar to a howling. The visualization of an example recording in this situation can be seen below: When MATLAB code is applied to three recordings, graphs bellow (Frequency vs. Amplitude) will be generated: As it can be clearly seen from the graphs, frequencies of three recordings were cumulated around 800 Hz. Even though their amplitudes vary (this may be due to the fact that the time I recorded each one was different, so the distance between Lucky and my microphone varied each time), their frequencies are roughly around the same value. Moreover, they also peak around the same value: Figure 7 around 800, Figure 8 around a little bit over 800, and Figure 9 around a bit less than 800. Hence, we can generalize the frequency of distress type of barking as approximately 800 Hz. Figure 6: Distressed barking of Lucky. Here, every blue trace represents a “Woof” sound that Lucky makes. Figure 7: Distressed Barking 1. Figure 8: Distressed Barking 2. Figure 9: Distressed Barking 3.
  • 32. 32 3.3.2 Anger Barks in this situation can be described as low-pitched, thick sounds. The visualization of an example recording in this situation can be seen below: When MATLAB code is applied to three recordings, graphs bellow (Frequency vs. Amplitude) will be generated: As it can be clearly seen from graphs, frequencies of three recordings were cumulated around both 400/500 Hz and 800 Hz. Again, even though their amplitudes vary (this is due to the fact that the distance between Lucky and my microphone varied each time), their frequencies are roughly around the same value. Moreover, their peaks are around the same value: Figure 11 around 400 Hz, Figure 12 around 500 Hz, and Figure 13 around 500 Hz. Therefore, it can be seen that there’s a clear distinction from distressed barks. Hence, we can generalize the frequency of. anger type of barking as approximately 500 Hz. Figure 10: Angry barking of Lucky. Here, every blue trace represents a “Woof” sound that Lucky makes. Figure 11: Angry Barking 1. Figure 12: Angry Barking 2. Figure 13: Angry Barking 3.
  • 33. 33 3.3.3 Excitement Barks in this situation can be described as neither high nor low-pitched. The visualization of an example recording in this situation can be seen below: When MATLAB code is applied to three recordings, graphs bellow (Frequency vs. Amplitude) will be generated: As it can be clearly seen from graphs, frequencies of three recordings were cumulated around 600 Hz. Furthermore, peaks of all three are around 600 Hz although there is also a small cumulation around 800 as well. Therefore, it can be seen that there is distinction from other two type of barks, one being around 800 Hz and other 500 Hz. Hence, we can generalize the frequency of excited type of barking as approximately 600 Hz. Figure 14: Excited barking of Lucky. Here, every blue trace represents a “Woof” sound that Lucky makes. Figure 15: Excited Barking 1. Figure 16: Excited Barking 2. Figure 17: Excited Barking 3.
  • 34. 34 4. Conclusion and Evaluation In the first part of this Extended Essay, I explored the concepts of Fourier Series and Fourier Transform in order to comprehend the fundamental mathematics behind them and use it in my MATLAB code later on. In the second part, I applied my knowledge to some real-life recordings of my own dog. After my analysis, it was found that barks held certain patterns in their frequencies that reflected the present motivational changes of the dog. In distressed barking type, sounds were high-pitched, and their frequencies were cumulated around 800 Hz. Furthermore, in angry barking type, sounds were low-pitched, and their frequencies were cumulated around 500 Hz. Lastly, in excited barking type, sounds were neither high-pitched or low-pitched, and their frequencies were cumulated around 600 Hz. Although there was a distinction between the recordings of barks, there were some weaknesses in my study, first one being the limitations in the experimental method. As I mentioned before, I didn’t provoke Lucky to bark in a way, rather, I recorded his barks when they occurred naturally. Hence, the time I recorded each of them was different. This caused me to vary the distance between my microphone and Lucky, which lead to different amplitude results in each recording. However, this didn’t prevent me to continue my research, as I was investigating frequencies of the recordings. Secondly, I believe that my results are too narrowed to be generalized for any kind of wider dog population, since I only investigated the barks of my own dog, who has certain particular characteristics as his gender, his age, his breed and etc. Lastly, after my research, I came to a conclusion that Fourier Analysis alone might not be sufficient to clearly distinguish between a dog’s motivational changes, since results for angry and excited barks were relatively close. Hence, in future studies, other characteristic of sounds can be investigated, such as time intervals between the end
  • 35. 35 of each bark to the start of the next one, or the time that it takes for an individual bark to be complete. Considering these, I believe that this study can be extended in future. The Fourier Transform code in MATLAB can be turned into an Artificial Intelligence based algorithm. With machine learning, this AI program can learn and adapt itself to new recordings of dog barks and can detect certain patterns between them without human intervention, which would be much more efficient. 5. Bibliography 262588213843476. “Plotting the Signal and Fourier Transform in Matlab.” Gist, gist.github.com/pbianche/2584364. Accessed 11 January 2021. blackpenredpen. “Fourier Series Coefficients.” YouTube, 4 Jan. 2019, youtu.be/iSw2xFhMRN0. Accessed 9 September 2020. Das, Kaushik & Ghosh, Amitava & Basu, Debashis & Miller, Larry. (2014). Soil Structure and Fluid Interaction Assessment of New Modular Reactor: Part 1 — Numerical Simulation of Fluid Motion due to Seismic Waves. ASME 2014 Small Modular Reactors Symposium, SMR 2014. 10.1115/SMR2014-3319. Accessed 10 October 2020. Definition of Fourier Series and Typical Examples. Math24, 26 Apr. 2020, www.math24.net/fourier-series-definition-typical-examples/#example2. Accessed 9 September 2020. Electrical Waveforms and Electrical Signals. Basic Electronics Tutorials, 26 Apr. 2020, www.electronics-tutorials.ws/waveforms/waveforms.html. Accessed 9 September 2020.
  • 36. 36 Fourier Series. Math Is Fun, www.mathsisfun.com/calculus/fourier-series.html. Accessed 9 September 2020. Home En. FFT, www.nti-audio.com/en/support/know-how/fast-fourier-transform-fft. Accessed 10 October 2020. Physics and Math Lectures. Deriving the Fourier Transform From Fourier Series. YouTube, 2 July 2020, www.youtube.com/watch?v=wmUdNKLrWeo. Accessed 20 December 2020. Viktor Lavrenko. “IAML2.19: Representing music with Fourier coefficients”. Online video clip. YouTube. YouTube, 10 September 2015. Accessed 9 September 2020. Which Emotions Do Dogs Actually Experience? Modern Dog Magazine, moderndogmagazine.com/articles/which-emotions-do-dogs-actually- experience/32883. Acessed 11 January 2021. All graphs were created in Desmos (https://www.desmos.com/) unless otherwise cited. 6. Appendices Appendix A Expressing Products of Cosines in Terms of Cosine 𝑐𝑜𝑠(𝑛𝑥)𝑐𝑜𝑠(𝑚𝑥) = 1 2 [𝑐𝑜𝑠((𝑛 − 𝑚)𝑥) + 𝑐𝑜𝑠((𝑚 + 𝑛)𝑥)] Appendix B Expressing Products of Sines in Terms of Cosine 𝑠𝑖𝑛(𝑛𝑥)𝑠𝑖𝑛(𝑚𝑥) = 1 2 [𝑐𝑜𝑠((𝑛 − 𝑚)𝑥) − 𝑐𝑜𝑠((𝑚 + 𝑛)𝑥)]
  • 37. 37 Appendix C Expressing Products of Sines and Cosines in Terms of Sine 𝑠𝑖𝑛(𝑛𝑥)𝑐𝑜𝑠(𝑚𝑥) = 1 2 f𝑠𝑖𝑛z(𝑛 + 𝑚)𝑥{ + 𝑠𝑖𝑛z(𝑛 − 𝑚)𝑥{g Appendix D Expressing Products of Cosines and Sines in Terms of Sine 𝑐𝑜𝑠(𝑛𝑥)𝑠𝑖𝑛(𝑚𝑥) = 1 2 [𝑠𝑖𝑛((𝑛 + 𝑚)𝑥) − 𝑠𝑖𝑛((𝑛 − 𝑚)𝑥)]