Numerical Analysis 1


Hello, if you have any need, please feel free to consult us, this is my wechat: wx91due


Numerical Analysis 1 – Week 2

January 14 & 16, 2025
This problem set due January 26th .

Subjects covered

  • Sampled data and time series.
  • Taking numeric derivatives.
  • Complexity – big-O notation.
  • Fourier series and Fourier transform.
  • Filtering and processing of signals in the time and frequency domain.

Readings

  • “Numerical Computing with Matlab”, chapter 8, Fourier Analysis, by C. Moler (linked on Canvas).
  • “An FFT Tutorial” by S. Brorson (on Canvas).
  • Kutz, Sections 4.1, 10.1, 13.1 – 13.3.

Problems

Most of the following problems require you to write a program. For each program you write, please make sure you also write a test which validates your program. The test should call your program and check that your implementation returns the correct results. Zip up your code and answers and either upload them to Canvas or e-mail them to our TA, Spencer Andersen, [email protected].

Problem 1

When you dial a touchtone phone, the each button generates a so-called DTMF (Dual Tone, Multi-Frequency) signal which is composed of two sine waves atdifferent, incommensurate frequencies. Different buttons emit different DTMFsignals. The DTMF signal is used to command the telephone company's switching equipment which numberyou want to dial. Different digits are representedby different pairs of frequencies. The frequency assignments are shown in thetable below.

Under the class 2 materials section of Canvas I have placed a zip file containing sound samples corresponding to a 10 digit telephone number (area code + phone number). The samples are labeled “A”, “B”, ... “J” (in order). Your assignment: Download the samples and write a program which deduces the telephone number being dialed. Obviously, this is an exercise in using the FFT to process the sound signals. Use “audioread” to read in the signals. Your program should loop through all the sound files,FFT each one, and print out the number being dialed. The hard part is figuring out the units of the frequency axis. Use the materials from lecture or my tutorial on Canvas to compute the units.

Hand in the telephone number being dialed (“A” first, “B” second, etc.) along with your code. Matlab provides a nice set of signal processing tools in one of its toolboxes. For this problem please don’t use the signal processing toolbox for your answer. It’s OK to use the toolbox to check your result, but please use fft() and friends in your code submission. Regarding testing, if your program finds correctly-scaled frequencies, that is sufficient.


1209 Hz
1336 Hz
1477 Hz
697 Hz
1
2
3
770 Hz
4
5
6
852 Hz
7
8
9
941 Hz
*
0
#

Problem 2

Consider the inverted parabola y(t) shown below.

The relevant part of the function is defined over the domain -1 < t < 1. The peak of the parabola occurs at t = 0. Assume the function y(t) is zero for abs(y) > 1/2.

Please do the following:
  • Using pencil/paper, derive the coefficients of its Fourier series expansion. (You can exploit the fact that the function is anti-symmetric about origin to deduce the basis functions for the expansion.) To perform the integrals, I suggest you use the Wolfram Alpha integral calculator, available online at http://www.wolframalpha.com/calculators/integral-calculator/.
  • Take M to be the highest order term in your series expansion. Write a program which loops over in creasing M and makes a plot similar to that below showing how the series converges to the inverted parabola. (My result is shown at right.)
  • Next, make a plot of the RMS error between your Fourier series expansion and the original function y(t) as a function of highest order term summed M. The RMS error is defined as  

(For more information, please consult the note “On Computing RMS Error” available under “Course Materials” on Canvas.) My RMS error plot is shown below.

Hand in your derivation of the Fourier coefficients, as well as your code which makes the two plots. Regarding testing, showing that the Fourier series converges to the input function with increasing M is a sufficient test.

Problem 3

This problem explores using the FFT to dig a signal out of ,noise. Morse Code is a very old technique used to encode letters as a sequence of long and short single-frequency tones.

In the very early days of radio – before voice transmission be-came possible – Morse Code was the primary means of communication. You may read more about Morse Code on

Wikipedia, https://en.wikipedia.org/wiki/Morse_code. A table presenting how each letter is encoded using International Morse Code is given on that Wikipedia page.

A common problem in data transmission is that a signal can be corrupted by additive noise. However, signals which have a simple spectrum may be recovered using frequency-domain filters. Since Morse Code is just a sequence of single-frequency tones, removing noise from a corrupted signal is easily achieved. For this problem I have placed on Canvas a .wav file of a Morse Code message buried in noise. Your job is to take the .wav file and use the FFT to filter the signal enough that you can decode the message. Please write a program which does this:


  • Read the .wav file and play it through your computer’s speakers. Matlab’s sound() function will do this for you. The signal will sound terrible, and you won’t be able to hear the Morse Code message at all.
  • Calculate the FFT of the signal and plot it. This will help you identify how you need to filter the signal to extract the message – the signal of interest are the peaks you will see in the spectrum.
  • Filter the noisy signal using e.g. a box filter. That is, keep the Fourier coefficients corresponding to the desired signal and set all others to zero. You will need to keep a range of coefficients around all the peaks you find.
  • Inverse FFT the filtered signal and play it through your computer’s speakers. If you have done everything right you will hear the on-off tones of my Morse Code message. There is a trade-off in filtering – you need to keep more coefficients around the peaks in order to reproduce the time-behavior of the signal (i.e. capture the on-off tones), but of you keep too many coefficients the noise will begin to dominate the sound. You will need to play around with the spectral width of your filter box in order to optimize the message signal.
  • Listen to the filtered signal and use the Morse Code table on Wikipedia to decode the short message I embedded in the signal. What is my message? It may help to make a plot of the filtered signal in the time domain to see which are the long and which are the short tones. 
Regarding testing, it’s enough to have a function which reads the noisy signal filters it and plays the filtered signal. If you can find my message, then your program works.


发表评论

电子邮件地址不会被公开。 必填项已用*标注