[SOLVED] BIOENG1320 Biological Signal & Systems MATLAB Project 3

30.00 $

Programming resource
Digital learning resource
Category:
βœ“ Practical programming resource
βœ“ Suitable for guided study and reference
βœ“ Tutor guidance available when needed

Description

Rate this product

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:

𝑋(πœ”) = βˆ‘π‘π‘›=βˆ’01 π‘₯(𝑛 𝑇𝑠)π‘’βˆ’π‘—πœ”π‘‡π‘ π‘›π‘‡π‘ .

(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π‘πœ‹π‘˜ = βˆ‘π‘π‘›=βˆ’01 π‘₯(𝑛 𝑇𝑠)π‘’βˆ’π‘—2π‘πœ‹ π‘˜π‘›π‘‡π‘ ,

π‘˜ = 0,1, … , 𝑁 βˆ’ 1.

(4)

For convenience, 𝑇𝑠 is set to unity to arrive at the β€œDiscrete Fourier Transform (DFT)” as follows:

𝑋[π‘˜] = βˆ‘π‘π‘›=βˆ’01 π‘₯[𝑛]π‘’βˆ’π‘—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

  1. 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?

  1. 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?

  1. 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!)

  1. 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?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.

  1. Plot the DFT magnitude and phase spectra for the noisy action potential signal from Project
  2. 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 frequency

domain? Noting these differences should help in filter design.

  1. 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?

 

Resource details

Understand the Task Before You Use the Resource

Review the requirements, identify the programming concepts involved, study the implementation and test your understanding with your own examples and modifications.