Noise cancellation with Fourier
Consider the data (xi , yi) for i = 1, . . . , N such that xi = x1 + (i − 1)h and
yi = f(xi) + σi
where f is a periodic function of period ω and σi are random variables
Write a function that takes as input a matrix D ∈ R
, Di = (xi
and the period ω and returns a plot showing a fit of the data without noise.
Do this by cleaning the noise in the frequency space.
Proceeds as follows:
• use fft to retrieve the Fourier sequence associated with the input data,
• remove the spourious frequencies. How many frequencies are you removing? Why?
• reconstruct the initial function using ifft
If only one input is given, consider the difference between xN and x1 to
be the period.
Test your code on Homework4 set1.mat, that has period 2π, and Homework4 set2.mat
and Homework4 set3.mat, whose period is not given.
Discuss this problem and the result in a report (≤ 1 computer typed
A phone number is converted by a phone into a signal via a method that is
based on the Dual Tone Multi-Frequency system. In this system every digit
is associated with two frequencies. We will use a simplified version with
only one frequency, that can be found in the table below (frequencies are in
Ideally the signal is zero when no key is pressed, while for the duration
of the key-press the signal is a sine with the frequency provided above.
Unfortunately, there is noise in the signal, both during hte key press and
inbetween keys. Have a look at the file signal.mat for an example signal.
Also zoom in on a piece where a key is pressed to get an idea about of
the signal. You can listen to the signal with sound(signal,4096), where
4096 is the sampling rate of the signal. You will notice that not all keys are
pressed equally long and also the time between two digits is not uniform.
Moreover, the signal is a bit noisy and not all digits have equal amplitude.
The challenge is to write a function that extracts the phone number from
The input variables are a vector with the signal, and the sampling rate.
The output is a row vector with the digits of the phone number.
• The first step is to find the pieces in the signal which represent the digits (and to determine the number of digits).
• From the piece of signal representing one digit, the function extracts the frequency using the Fourier transform.
• Finally, the function determines the digit associated with the frequency.
• The combination of these steps leads to the phone number.