White Noise detection and elimination

I’m working on a series of blocks to measure the level of white noise
and attentuate it. (Yes, I know there are better ways of doing this,
like a Wiener filter - my goal here is to experiment and learn.)

Model: Assume white noise is present in equal power at all frequencies.

Plan:
Signal --> FFT --> [Find min power val over entire freq vector] -->
[Subtract that min val from all freq] --> IFFT --> Output

Two questions:

  1. Will this work?

  2. What format does the FFT output vector use? I imagine to find the
    min power at any freq I need to write my own block - hopefully I can
    do this in Python. Code to do that in Python is trivial, but I can’t
    find the FFT output vector format documented. Likewise for “Subtract”

  • I mean this as a mathematical subtraction, not attenuation
    (multiply), which would attentuate the signal just as much. So if the
    FFT output vector is in a logarithmic format, I need to first turn it
    into a linear format before subtracting.

On Mon, Nov 18, 2013 at 08:29:02AM -0500, Robert J. wrote:

Two questions:

  1. Will this work?

I doubt it will do what you want it to.
What do you mean, ‘subtract that min val from all freq’? How do you
subtract a power value from a complex amplitude?

  1. What format does the FFT output vector use? I imagine to find the
    min power at any freq I need to write my own block - hopefully I can
    do this in Python. Code to do that in Python is trivial, but I can’t
    find the FFT output vector format documented. Likewise for “Subtract”
  • I mean this as a mathematical subtraction, not attenuation
    (multiply), which would attentuate the signal just as much. So if the
    FFT output vector is in a logarithmic format, I need to first turn it
    into a linear format before subtracting.

I’m not sure you understand what the FFT does. Output is complex values.

A power spectrum density could be displayed logarithmically, but that’s
not an FFT.

I’m not sure what you’re attempting, but it looks like you want to

  • find frequencies with power
  • design a filter that attenuates the rest
  • filter your (time-domain) signal.

MB


Karlsruhe Institute of Technology (KIT)
Communications Engineering Lab (CEL)

Dipl.-Ing. Martin B.
Research Associate

Kaiserstraße 12
Building 05.01
76131 Karlsruhe

Phone: +49 721 608-43790
Fax: +49 721 608-46071
www.cel.kit.edu

KIT – University of the State of Baden-Württemberg and
National Laboratory of the Helmholtz Association

Thanks. Here’s my understanding of FFT - please let me know where my
mistake is:

FFT gives you the power at every freq - eg 10 Hz is at power 0.1mW
100Hz is at 0.03 mW etc. I’m not sure how it’s represented, but
that’s essentially the information it has.

We can easily multiply by a constant - that’s a simple LTI , mapping
impulse -> 2 * impulse

What I want to do is not an LTI. In the case above, if I found that
every freq had power of at least 0.03mW, I’d assume there’s a white
noise component at that power across the spectrum, “subtract” it out,
yielding 10 Hz power at 0.07mW, 100Hz at 0mW, etc., and then IFFT.

I’m eager to learn what’s wrong with my concept, especially from the
experts here.

Even if it is completely wrong, I’d like to know the format of the
FFT output vector, so I can experiment myself. What is the format?

On Mon, Nov 18, 2013 at 09:56:03AM -0500, Robert J. wrote:

I’m eager to learn what’s wrong with my concept, especially from the
experts here.

Robert, there’s a lot of basics that need to be covered here. You might
have to go into the textbooks.

First of all, the FFT does not give you the power at a frequency. It
gives you a Fourier coefficient. It’s amplitude does have something to
do with the power, but it’s not the same.

Short tangent: You can estimate a PSD by using an FFT and then
mag-squaring the output. This is called a ‘peridogram’.
You can get a better estimate by applying a window, and averaging
several periodograms. This is called ‘Welch’s method’.

Now here’s the difference: You’re chucking away the phase, and
squaring the amplitude. So what are you subtracting from what?

This goes on and on. Have look at the concept of ‘digital filtering’,
and specifically the Fourier method of designing filters. You will find
some similarities to your approach.

Also, be careful when assigning absolute powers (in Watts) to FFT bins!
I guess it’s technically correct when you multiply the PSD value here
with the size of the FFT bin, but that assumes a good estimate of the
PSD, and for absolute values, that you have calibrated your system
correctly.

Even if it is completely wrong, I’d like to know the format of the
FFT output vector, so I can experiment myself. What is the format?

Complex numbers (representing Fourier coefficients).

MB


Karlsruhe Institute of Technology (KIT)
Communications Engineering Lab (CEL)

Dipl.-Ing. Martin B.
Research Associate

Kaiserstraße 12
Building 05.01
76131 Karlsruhe

Phone: +49 721 608-43790
Fax: +49 721 608-46071
www.cel.kit.edu

KIT – University of the State of Baden-Württemberg and
National Laboratory of the Helmholtz Association

Got it: The Fourier coefficients tell you two things per freq:
amplitude and phase. In real values (what I’m used to), those are two
distinct numbers. In complex values (welcome to DSP), it’s one
complex number, telling you the amplitude of the 0-degree component
(Re) and the amplitude of the -90-degree component (Img).

Going from complex to real is easy: complex r = real amplitude,
complex theta = real phase. But that’s besides the point. The point
is that amplitude alone is only half the story, phase is the other
half, and, without phase, you can’t reconstruct the original signal.
(The FFT displays might not show the phase, and we might not alwasy
talk about it, but it’s half the information, like it or not.)

So while FFT is invertible to signal, PSD isn’t.

What about this approach, then: Put the Fourier coefficients of in
polar coordinates. White noise will tend add a fixed complex value,
call it W, to each Fourier coefficient of the signal. Assuming the
original signal has many zero Fourier coefficients (many more than
nonzero), when we add the noise, the most common coefficients will be
close to W.

If there is a complex value, call it W-hat, that is within delta of x%
of Fourier coefficients, we assume W-hat is the value of the additive
white noise. Subtract W-hat from all the Fourier coefficients, IFTT,
and recover the signal with much of the white noise removed.

Hi Robert,

I fear you’re still off track.
First of all, “white” is a stochastic property of the signal. You can’t
see “whiteness” of additive noise in a single FFT; you can’t see it in
an average of time samples, either, because, let’s assume this noise’s
amplitude follows a distribution that’s first moment is 0, then the
average amplitude addition (in time domain) is 0.
Since this addition is spread over all frequencies (white), white
complex noise will not tend to add a constant complex value - that
wouldn’t be white, it would have an dirac impulse on f=0! That’d just be
a boring bias :wink:
So, really, you need to dig a little deeper into literature. I do have a
strong feeling you will get to terms with these signal properties soon
enough, but up until now the problem is not related to the signal being
real, complex, discrete or continuous. There are a few misconceptions on
stochastic here!

Your explanation of “going from complex to real” did not make much sense
to me, sorry. You can’t go from complex to real, the former vector space
is a superset of the latter, and thus there is no reversible mapping
from complex to real.

And once again, “subtracting W hat from all the coefficient and get the
signal without noise” is plain wrong. Your noise is different and
independent from sample to sample (that’s what “white” implies!), so if
you always subtract the same thing, you’re bound to do something wrong.
Sure, for some realizations of the random variable “noise amplitude in a
sample”, you might be going in the right directions, but usually, you’ll
be wrong half of the time, and that’d be worse than not doing your
signal processing.

Hope that helps a little bit :slight_smile:
Greetings,
Marcus

On Mon, Nov 18, 2013 at 11:25 AM, Robert J. [email protected]
wrote:

(The FFT displays might not show the phase, and we might not alwasy

If there is a complex value, call it W-hat, that is within delta of x%
of Fourier coefficients, we assume W-hat is the value of the additive
white noise. Subtract W-hat from all the Fourier coefficients, IFTT,
and recover the signal with much of the white noise removed.

This is not going to filter any noise. Remember that the
auto-correlation of white noise (should be) an impulse. If you’re
taking the minimum value and subtracting that value from other FFT
bins that’s not really meaningful. One of the DFT properties:

ax1[n] + bx1[n] -> aX1[k] + bX2[k].

Let’s make the actual signal x1[n], and a=1. You’re making X2[k] a
step since you subtract the same value from the original signal’s FFT.
The value of b you’re using is the smallest random number you find,
the specific value isn’t important. In the time domain you’re just
subtracting a sort of sinc with amplitude that changes every FFT
length. Definitely not reducing any noise.

The noise in each sample should be independent if you’re assuming white
noise.

I believe the correct term for what I’m trying to find is PSD, which,
as far as I can tell (eg from here
http://www.mathworks.com/help/signal/ug/psd-estimate-using-fft.html ),
is well estimated using the FFT.

Got it. I was assuming that since sinc looks like white noise, white
noise would look like sinc. That’s not true - white noise is plain
ol’ random.

Thank you everyone for the great discussion.

On 11/18/13, Marcus M. [email protected] wrote:

half, and, without phase, you can’t reconstruct the original signal.
(The FFT displays might not show the phase, and we might not alwasy
talk about it, but it’s half the information, like it or not.)

Thanks Marcus. By “going from complex to real” I simply mean that
given complex Fourier coefficients, we can easily map that to real
amplitude (abs(z)) and real phase (angle(z)). In other words, a
vector of complex Fourier coefficients is the same thing as 2 real
valued vectors, one for amplitude, one for phase - just in a different
form. Is that not correct?

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs