0
$\begingroup$

I have a noisy signal file in Matlab and I have to denoise the polluted signal using a discrete Fourier transform.

I'm asked to perform the fourier transform, then take its absolute value. Then study/examine the absolute values to then implement a low-pass filter for the actual sound (and corresponding high-pass filter for the background noise) in Matlab.

Any ideas on general approaches? This is an intro course so suggestions shouldn't be too formal. Also this is homework so only hints please.

$\endgroup$
1
  • $\begingroup$ I was browsing some filtering stuff and came across these two sources that talk in more detail about the issue you mentioned with the $|F_0| = |F_{N-1}|$ symmetry. Maybe they'll clarify things a little. First link (pdf). Second link (mathworks forum). Google searches for "matlab fftshift" also bring up various relevant discussions/blog posts. $\endgroup$
    – dpbont
    Mar 13, 2014 at 8:08

2 Answers 2

1
$\begingroup$

Based on your description it sounds like the idea is to use the FFT to figure out where your signal energy is in terms of frequencies. Once you know that you know what the passband of your filter should be, and from that you can decide on a reasonable cutoff frequency. You want to cutoff as much of the noise energy as possible which means you want to have the cutoff frequency as close to the passband frequency as possible, but you need some space for the transition band to make the filter implementable with a reasonable number of taps.

By the way, I often like to look at the signal energy in the log scale because it helps to get a better understanding of the weaker portions of the signal. In Matlab you do it like so:

plot(20*log10(abs(fft(signal))))
$\endgroup$
6
  • $\begingroup$ I guess my fundamental understanding of FT is missing a little. My input is a sound sample - when I perform the FFT I am able to notice the difference between the background noise and actual sound based on the magnitudes of the Fourier Coefficients... but what do these fourier coefficients represent? I simply removed some that were past a threshold - why does this separate the 2 sounds? $\endgroup$ Mar 9, 2014 at 23:06
  • $\begingroup$ The complex values that the discrete Fourier Transform outputs represents the set of complex exponentials that, if added together, would recreate your sound sample (or rather, your sound sample repeated an infinite number of times, but that's another conversation). The amplitudes and phases of the coefficients are the amplitudes and phases of the complex exponentials that you would need to use to recreate the signal. $\endgroup$
    – Jim Clay
    Mar 10, 2014 at 0:04
  • $\begingroup$ When you say that you "removed some that were past a threshold" it sounds like you were doing some simple energy thresholding. $\endgroup$
    – Jim Clay
    Mar 10, 2014 at 0:05
  • $\begingroup$ My notes say the fourier coefficients represent the frequencies in which the data repeats 1 time, 2 times, etc. Essentially the fourier coefficients count the frequencies of the different patterns of my data. So basically performing my 'energy thresholding', I am removing values that have a different pattern i.e. separating background noise from actual noise. Is my understanding correct? $\endgroup$ Mar 10, 2014 at 0:24
  • $\begingroup$ @bobvanreines Your understanding of the FT is sort of correct but a little too simplistic. It would be easier to help if you could post plots of your data and processing steps (FT, signal separation, etc.) somewhere and link to them in your post. $\endgroup$
    – Jim Clay
    Mar 10, 2014 at 12:57
0
$\begingroup$

Sorry if this is too basic, but I'll try to describe what the Fourier transform means (also, warning: I'm not good at short explanations). Any "time series" (signal) can be described as the sum of individual sine waves, each with a different frequency. Any one frequency will have a certain amount of power that is not necessarily the same as other frequencies' power. Where your notes talk about "patterns" in the data, that's what I mean by these individual sine waves that we sum up. The important point that the Fourier transform is based on is that any signal can be approximated by a sum of sine waves of different frequencies (the classic example is the square wave). Even if the signal is aperiodic, you can construct a set of sine waves of different frequencies and different powers that approximate your signal. As you use a larger number of sine waves, you get a better approximation.

With sound, power corresponds to loudness. If you play two notes on the piano at the same time, one loudly and one quietly, then one note "has more power in the signal" (is louder) than the other. The Fourier coefficients are essentially the powers of each frequency. Say you have a simple signal that is the sum of 3 sine waves: one at 20Hz, one at 31Hz, and one at 49Hz. If you calculate Fourier coefficients of the signal between 1Hz and 100Hz and plot them, that will be something like your "power spectral density" - how powerful/present each frequency is in the signal. This plot would be zero everywhere except for peaks at 20, 31, and 49 Hz, because all frequencies except those three have zero signal power.

This can be useful for filtering, because sometimes the signal and noise exist in nonoverlapping frequency bands (let's say your signal is only the 31Hz component; then low frequency noise is 20Hz and high frequency noise is 49Hz). You can look at what they are with the PSD/Fourier coefficients plot, and that helps you decide where to set your cutoff frequencies to filter out unwanted frequency bands (aka noise).

In practice, all of these values will be ranges instead of individual values. So, low frequency noise might be all frequencies <20Hz, high frequency noise might be all frequencies >100Hz, and the signal might exist in the 30-80Hz band. You can then filter appropriately (high-pass filter for frequencies <30Hz, low-pass for frequencies >80Hz). It's not always clean like this: sometimes the different bands overlap (e.g. if signal has 50Hz-500Hz components and noise has frequencies >300Hz, then you have interference between 300 and 500 Hz that is harder to separate out). To make these claims you need to know some characteristics of the signal, which you often do. For example, just above middle C is the note "A" at 440 Hz, and my speaking voice is usually more than an octave below that. If you want to remove higher frequency noises (say, a dog is whining in the background that you want to suppress), you can low-pass filter at 220 Hz (1 octave lower = 1/2 frequency) and know that my voice will still be there.

There are a few ways to filter in Matlab. If you search for band-pass filters you can find something that's easy to implement (aka matlab functions that band-pass filter). You can also search for low-pass and high-pass individually; depending on the filter it doesn't make a difference if you do a band-pass vs. if you do the two steps separately.

Hope that helps, good luck!

$\endgroup$
7
  • $\begingroup$ For your example on the high-pass filter, for frequencies <30, don't we need to consider the right half as well since the outputs of the power spectrum for our DFT are symmetric? So for e.g. if we had 100 outputs, wouldn't we have to do <30 as well as >70? $\endgroup$ Mar 10, 2014 at 14:31
  • $\begingroup$ What would the reasoning be for having a symmetric filter? The DFT won't necessarily be symmetric around any given frequency. I'm not trying to shut down/slam your comment, I'm just trying to understand the reasoning the motivated your statement. What assumptions are you making about the characteristics of the DFT in this case? Or what attributes do you think it has? Just trying to get a grasp on the angle you're coming from. $\endgroup$
    – dpbont
    Mar 10, 2014 at 15:25
  • $\begingroup$ I was taught that $|F_0|$ = $|F_{N−1}|$ and so on. ie the absolute values are symmetric. This proved true for my results (See comments on Jim Clay's answer). $\endgroup$ Mar 10, 2014 at 15:47
  • $\begingroup$ Disclaimer: I haven't worked rigorously through the math details of Fourier stuff - I know the concepts of what it is and use it in Matlab data analysis (but I do have a formal math background). From what I gather, the $|F_0| = |F_{N-1}|$ symmetry refers to the relationship between real and complex domains. Coefficients $0:N/2$ are real, and $N/2+1:N-1$ are complex. To take this into account, you can write it as $|F_0| = |F_{N-1}^*|$, for "$^*$" giving complex conj. If your signal is sound, only real coefficients should matter, and coefficients $0:N/2$ will cover the specified frequency range. $\endgroup$
    – dpbont
    Mar 10, 2014 at 16:29
  • $\begingroup$ "Coefficients $0:N/2$ are real, and $N/2+1:N−1$ are complex" Or more appropriately, the first half of the coefficients are for the real components of the signal and the second half of the coefficients are for the imaginary components of the signal. Coefficients themselves are real. (I think?) $\endgroup$
    – dpbont
    Mar 10, 2014 at 16:34

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.