Project Materials 

   

Back

 

Discrete Fourier Transform Project - Spring 2023

  • Dates

This is a group project. You are expected to work in groups of two. You will report your group composition on April 5th. The first progress report on your work to date is due April 12th, the second progress report will be due April 19th,  and the final full report will be due April 26th. All reports will be typed as described below.

  • First assignment: Warm-up I - April 12

This is a warm-up exercise getting you ready to use MATLAB.  For those not familiar with MATLAB, there are some additional help files listed below including Dr. Herman's Wiki called MATLAB a brief introduction for students. You can access MATLAB from the computer labs or through Tealware, https://tealware.uncw.edu. [Note: the text discusses how one can use GNU Octave (or online version) and Python to carry out these exercises as well.]

Read the section on using MATLAB to symbolically compute transforms and convolutions in Section 5.12 (page 260) or in the document faproject.pdf:  Then practice the examples in that section and do the following Exercises:

  • Pg 268: 14 15 21 24 27.

Report the results in report form (using sentences, paragraphs, standard mathematical notation and not MATLAB format, figures, numbered equations). Figures can be copied by going to Edit menu item and selecting Copy Figure. Then, go to your paper and paste (CTRL-V) where you want the figure. Make sure to resize your figures, add figure labels and captions, and refer to them in your report.

  • Second Assignment - due with progress report #2 - April 21.

In this part of the project you will be investigating the discrete Fourier transform from section 6.4.1. You will make observations about how well discrete Fourier transforms capture the spectral content of signals. Several files will be needed in this project. They are listed below and in the text.

a. Warm-Up II

Open MATLAB. Type edit in the Command Window. The editor will appear. Copy the following into the editor and save as myplot.m.

close all                % closes figures
clear                     % clears variables
N=128;                % Number of points used
T=1;                     % Time interval length
dt=T/N;                % Time steps
t=(1:N)*dt;           % Time

% Function to plot
f0=5;                    % Frequency
y=sin(2*pi*f0*t);

% Plot commands
plot(t,y)
xlabel('t')
ylabel('y(t)')
title('y(t) vs t')

In the Command Window type myplot. This will run the code in the file you saved. Is this consistent with what is in the code? Now, change the number of points, the length of time, the frequency. Each time you edit the file save it before running the code. Now, add to the function another sinusoidal function with a different amplitude and frequency. Copy several of these plots and include them in your progress report, noting the values of the parameters used. Proceed to the project:

b. DFT

Complete Part 1 of Problem 14 on Page 324 for this part of the project. Use the MATLAB file ftex.m, [Note: the MS Word document contains the same instructions for the rest of the project and may be useful when you do not have your book.]

  • FFT Part of Project - May 1

Complete Parts 2-4 of Problem 14 on Page 324 for this part of the project. In these parts you will learn about MATLAB's built-in fft function. In Part 2 you will verify that the fft function reproduces what you did in Part 1, building your confidence in the use of this "black box." You will then investigate the Fourier transforms of various functions and data sets, learning how to analyze time series using the fft function.

You will keep track of your observations with your partner and submit the results on the last class day in report form with full sentence and paragraph format and not as a list of homework exercises. This entire project will count as your computer lab/project grade for the course.

  • Working with MATLAB Files:

    Right Click-SaveAs to download files. Place them in MATLAB's Work Folder.
    [When you open MATLAB you will see the default directory in the left panel. The default should be the WINDOWS folder in your TIMMY directory. You could create a new folder, call it MATLAB and save the below files in that directory. When doing the project double-click your working folder at the beginning of each session before running the routines.]Alternatively, you can click on an m-file and cut and paste the text into the editor and save the file. You might consider dedicating a folder on a USB memory stick so you can work from different computers.

     

    Note: MATLAB changed format to read/write audio files. For example one can produce a 440 Hz note at a sampling rate of 11025. You can play it and write it to a file in MATLAB.


       smp=11025;
       t=(1:2000)/smp;
       y=0.75*sin(2*pi*440*t);
       sound(y,smp,8);
       audiowrite('mysound.wav',y,smp);
     

    Now, you can read a wav file and play it or analyze it.
     

       [y2,smp] = audioread('mysound.wav');
       sound(y2,smp)

    In GNU Octave, you can almost do the same thing. The following worked in version 8.2.0.

       smp=11025;
       t=(1:2000)/smp;
       y=0.75*sin(2*pi*440*t);
       audiowrite('mysound.wav',y,smp);

       [y2,smp] = audioread('mysound.wav');
       player = audioplayer (y2, smp, 8);
       play (player);

       n=length(y2);
       T=n/smp;
       dt=T/n;
       figure(1)
       plot(dt*(1:n),y2)
     

  • Additional Information

  • Report Format - for all parts!

All work should be typed with double-spacing and 12 pt font. You will be expected to use correct English grammar and punctuation. This is a report and thus you will use proper sentence and paragraph formatting. You will be graded on the evidence of work, mathematical detail and understanding, proper exposition and neatness. Your work should also be supported with properly labeled and embedded plots and equations. Any references used should be cited as well. These reports will count towards the project component of your grade.

Top

E-Mail: Dr. Russell Herman Last Updated: May 01, 2023