Starting from:

$29.99

Biological Signals and Systems MATLAB Project 3


BIOENG 1320 – Biological Signals and Systems
MATLAB Project 3

Computing the Fourier Transform of a biological signal: The Fourier Transform is perhaps the
most popular technique for analyzing biological signals. It allows the signals to be visualized in
the frequency domain via spectra. From Lecture, the Fourier Transform is given as follows:
𝑋(𝜔) = ∫ 𝑥(𝑡)𝑒
−𝑗𝜔𝑡𝑑𝑡 ∞
−∞
. (1)
In general, the biological signal 𝑥(𝑡) is too complicated to determine its Fourier Transform 𝑋(𝜔)
analytically (i.e., by pencil and paper). A computer must therefore be used. However, the Fourier
Transform is a continuous function and an infinite integral. As a result, it cannot be determined
with a computer! Three modifications are necessary for computer-based solution. First, the
integral is approximated using rectangular pulses of width 𝑇𝑠
to convert it to a sum as follows:
𝑋(𝜔) ≈ ∑ 𝑥(𝑛

𝑛=−∞ 𝑇𝑠)𝑒
−𝑗𝜔𝑇𝑠𝑛𝑇𝑠
. (2)
Then, the signal is assumed to be non-zero within the finite time interval [0, (𝑁 − 1)𝑇𝑠 + 𝑇𝑠
] so
that the infinite sum becomes a finite sum as follows:
𝑋(𝜔) = ∑ 𝑥(𝑛
𝑁−1
𝑛=0 𝑇𝑠)𝑒
−𝑗𝜔𝑇𝑠𝑛𝑇𝑠
. (3)
Finally, the continuous variable 𝜔𝑇𝑠
is sampled at intervals of 2𝜋
𝑁
over the range of [0,2𝜋] to
transform the continuous function to a discrete function as follows:
𝑋[𝑘] = 𝑋(𝜔)|𝜔𝑇𝑠=
2𝜋
𝑁
𝑘
= ∑ 𝑥(𝑛
𝑁−1
𝑛=0 𝑇𝑠)𝑒
−𝑗
2𝜋
𝑁
𝑘𝑛𝑇𝑠
, 𝑘 = 0,1, … , 𝑁 − 1. (4)
For convenience, 𝑇𝑠
is set to unity to arrive at the “Discrete Fourier Transform (DFT)” as follows:
𝑋[𝑘] = ∑ 𝑥[𝑛
𝑁−1
𝑛=0
]𝑒
−𝑗
2𝜋
𝑁
𝑘𝑛
, 𝑘 = 0,1, … , 𝑁 − 1. (5)
The DFT is a discrete function and a finite sum. As a result, it is amenable to computer-based
solution for a given “sampled signal” 𝑥[𝑛].
The Fast Fourier Transform (FFT) is a family of algorithms for efficient computation of the DFT.
These algorithms, in particular, are widely used in biological signal processing.
2
The purpose of this problem is to learn how to use the all-important, built-in fft function.
1. Figure 1 shows a continuous-time signal 𝑥(𝑡). The Fourier Transform of this signal can be
determined analytically and is 𝑋(𝜔) = 12 (
𝑠𝑖𝑛(6𝜔)
6𝜔
)
2
𝑒
−𝑗𝜔12
. Plot the magnitude and phase
spectra over an 𝜔 range of [0, 𝜋] using a fine sampling interval. This exact result will be
needed to compare the FFT results to be computed below.
Figure 1
2. Take samples of 𝑥(𝑡) at 𝑇𝑠 = 1 to define 𝑥[𝑛] as a vector of 25 samples in length using the
triang function. Use the fft function to compute the DFT of this signal for 𝑁 = 256. Plot the
DFT magnitude and phase spectra. Note that the x-axis should range over an 𝜔𝑇𝑠 of [0,2𝜋].
How does this result compare to the analytical result? What is the highest frequency shown
by the FFT?
3. Now plot the DFT spectra of the signal for 𝑁 = 16, 32, 128. Compare all FFT plots with the
analytical result. For what values of 𝑁 are the DFT samples (mostly) valid? Which values of
𝑁 are, for the most part, indicative of the true spectral content of the signal and why? How
can 𝑁 be chosen in practice without knowledge of the analytical result?
4. Use pair 17 in Table 7.1 (Fourier Transform pairs) and properties in Table 7.2 (Fourier
Transform properties) to derive 𝑋(𝜔) in question 1. (Hint: see Practice Exam 1!)
5. Compute the DFT for the clean action potentialsignal from Project 1. Plot the DFT magnitude
and phase spectra. Note that 𝑇𝑠 = 1 in the previous questions. This simplification turned out
to make frequencies for 𝑥(𝑡) and 𝑥[𝑛] the same values! However, in general, 𝑇𝑠
is not unity.
For example, 𝑇𝑠 = 0.0796 ms for the action potentialsignal. So,such simplification no longer
holds. From the red font, it can be inferred that the highest frequency shown by the FFT in
units of Hz is half the “sampling frequency” (i.e., 1/(2*0.0796)=6.2814 kHz in this case). So,
make sure to plot the spectra from 0 kHz to 6.2814 kHz! Do the spectra meet your
expectations for the action potential signal?
3
Designing a filter to remove noise from a biological signal: In Project 1, a filter impulse response
was given, which removed the noise in the noisy action potential signal without compromising
the information in the clean action potentialsignal. In practice, filters are not given! The purpose
of this problem is to learn how to design a filter.
6. Plot the DFT magnitude and phase spectra for the noisy action potential signal from Project
1. Compare to the corresponding plots of the clean action potential signal. This comparison
may be facilitated using units of decibels. What are the main differences in the frequencydomain? Noting these differences should help in filter design.
7. Now design a filter using window-based filter design to selectively remove the noise. Use the
built-in function fir1. Apply the filter to each signal while experimenting with different cutoff
frequencies. Plot the selected filter impulse response and each of the filtered signals. What
kind of filter was selected and what were the cutoff frequencies?
Deliverables: Submit a single pdf file containing answers to the questions, properly labeled
plots, and the source code.

More products