In this third part, our goal is to understand how a sinusoidal signal is transformed from the time domain to the frequency domain. This operation is important because you can learn how much information is found in the frequency range. For example, a time domain signal for ECG alone will not have sufficient information because it merely has recordings of heartbeat (i.e. signals) over a period of time. However, frequency domain analysis for ECG additionally will provide how many times a variation in amplitude of signals occurs over a period of time. A frequency domain, in this way, demonstrates how the signals are distributed within each given frequency band over a range of frequencies. And a conversion of signals between the time and frequency domains can be accomplished using Fourier transform (FT).
Let’s start with a definition. Signal is “a function that conveys information about the behavior or attributes of some phenomenon.” The time domain reveals how the amplitude of the signal varies in time, while frequency domain shows how many times a variation in amplitude with respect to frequency. Let’s look at an example of electrocardiography (ECG) again. An ECG shows repetitive signal waves, and their behaviors can be observed (i.e. how signals evolve) over time. It would be difficult to analyze every single important component of an ECG recorded over a long period of time. In this case, you would transform the signal to a frequency domain and observe each component repeated within a specific time interval. This is where Fourier Transform comes in.
FT can also be observed in image and video compressions. For example, jpg and mp3 are digital formats for images and sounds which use Fast Fourier Transform (FFT) algorithm. Since every continuous analog signal has to be converted to digital signals, using analog-to-digital converters, those signals need to be sampled at a certain frequency. This way, we can obtain discrete signals utilizing the Discrete Fourier Transform.
What’s interesting about Fourier series is that every waveform can be written as a sum of sine and cosine, but with a discrete set of frequencies. And using TF, we can decompose a waveform into sinusoids.
Let’s take a look at a signal that’s composed of more than one sine waves. The plot shows a real-world signal that has more than one frequency:
Figure 1: The initial signal
For each step below, we will examine how this signal is formed by adding more sine waves.
f1 = 1;
f2 = 0.5;
f3 = 1.5;
f4 = 4;
t = 0:0.01:4;
A1 = 0.5;
A2 = 2.5;
A3 = 7.5;
A4 = 3.5;
x1 = A1*sin(2*pi*f1*t)
x2 = A2*sin(2*pi*f2*t)
x3 = A3*sin(2*pi*f3*t)
x4 = A4*sin(2*pi*f4*t)
x = x1 + x2+ x3+ x4
The first signal added to the plot is the following:
figure %Figure 2
subplot(2,1,1)
plot(t,x,t,x1)
subplot(2,1,2)
plot(t,x1)
Figure 2: The first step to the signal from Figure 1
In Figure 2, a sine wave (bottom) is represented in the initial signal (top). The initial signal is composed of many other signals. We will try to obtain the blue signal from the top of the figure and demonstrate that any signal can be expressed as a sum of sines.
figure %Figure 3
subplot(3,1,1)
plot(t,x,t,x1+x2)
subplot(3,1,2)
plot(t,x2)
subplot(3,1,3)
plot(t,x1+x2)
The following signals should come as close as possible to the original signal. In every subsequent figure we will have the following three subplots:
Figure 3: The second step to the initial signal
Figure 3, we can see the signal starting to shape after the initial one. In subplot(3,1,3), you can observe that the shape is modified due to the addition of more signals. From this step, the signal begins to lose its perfectly sinusoidal shape.
figure %Figure 4
subplot(3,1,1)
plot(t,x,t,x1+x2+x3)
subplot(3,1,2)
plot(t,x3)
subplot(3,1,3)
plot(t,x1+x2+x3)
Figure 4: The third step to the original signal
In Figure 4, we can observe how the amplitude of the signal from subplot (3,1,3) evolved. A3 = 7.5 shows that when multiple signals are added, the resulting signal is generated by the addition of amplitudes at each point.
figure %Figure 5
subplot(3,1,1)
plot(t,x,t,x1+x2+x3+x4)
subplot(3,1,2)
plot(t,x4)
subplot(3,1,3)
plot(t,x1+x2+x3+x4)
The last step described in this short addition of sines demonstrates how to obtain the initial signal. This final signal added here has a bigger frequency compared to the previous one. We can observe how the subplot(3,1,3) from Figure 5 begins to have more curves when compared to the previous figure.
Figure 5: The final step to the original signal
As you can see in Figure 5, there isn’t any difference between the green signal from subplot(3,1,1) and the blue signal from subplot(3,1,3). This example is important because it represents the Fourier series logic, in which a signal is described as the sum of sine waves of different frequencies
Fourier transform is used to perform operations that are easy to implement in the frequency domain (e.g. filtering). After we get the results in the frequency domain, we can transform the signal back to the time domain where we can use in further processing.