# How much do Windowing procedures harm the signal?

Started by December 23, 2006
```Pygmalion wrote:
> Jerry Avins wrote:
>>> 1. Everybody are writing how good windowing is for supressing leakage
>>> (amplitudes at frequencies higher and lower than the signal frequency).
>>>  However nobody says how much it supresses amplitude at signal
>>> frequency itself.  It surely must suppress it a bit, after all if you
>>> multiply signal with something LESS than 1 it must be smaller.  But how
>>> much? (if possible, make an estimate at least for Hann window)
>> It's only the relative amplitudes of the signal and the leakage that
>> matters. If the signal is reduces to half it's unwindowsd magnitude and
>> leakage is reduced to 1 tenth. multiplying by 2 makes that unchanged and
>> one fifth.
>>
> Right.  But how do you know how much is the signal's magnitude reduced?
>  And what is the factor to multiply the obtained spectrum to obtain
> signal's exact amplitude?  I really wish to obtain exact amplitude and
> not so much to get rid of sidelobes.

You can't accurately measure the signal when side lobes contaminate it.
The signal's amplitude is proportional to the area under the window. You
can calculate that, or you can calibrate it by sampling an integer
number of cycles of sinusoid of known amplitude and comparing the
transform result with and without tapered window. The integer number of
cycles, if there are enough of them, practically eliminates the effect
of leakage on the measurement. (Windowing one cycle of a cosine leads to
a strange result.)

Jerry
--
Engineering is the art of making what you want from things you can get.
&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;
```
```Pygmalion wrote:
> OK, so it is a usual practice to use windowing, and then divide it with
> coherent gain in order to obtain real magnitude for oscillation?

Yes, but that's not the whole story.  You will not obtain the "real
magnitude" unless (a) your signal frequency is on an FFT bin center and
(b) your window's sidelobes are sufficiently (for your application)
small.  If you signal's frequency is NOT on a bin center, the amplitude
will be reduced by the window's "scalloping loss" (see Harris).  If the
sidelobes are too high, your amplitude estimate will be significantly
corrupted by the high frequency terms caused by your signal's
discontinuity at the edges.

By the way, if you are repeatedly applying your window to multiple data
sets, scale the window by the coherent gain rather than your FFT
outputs.  It yields the same answers but with fewer operations.

Mike

>
> Regards, Marko
>
> Jeff Caunter wrote:
>>> Jerry Avins wrote:
>>>>> 1. Everybody are writing how good windowing is for supressing
>> leakage
>>>>> (amplitudes at frequencies higher and lower than the signal
>> frequency).
>>>>>  However nobody says how much it supresses amplitude at signal
>>>>> frequency itself.  It surely must suppress it a bit, after all if
>> you
>>>>> multiply signal with something LESS than 1 it must be smaller.  But
>> how
>>>>> much? (if possible, make an estimate at least for Hann window)
>>>> It's only the relative amplitudes of the signal and the leakage that
>>>> matters. If the signal is reduces to half it's unwindowsd magnitude
>> and
>>>> leakage is reduced to 1 tenth. multiplying by 2 makes that unchanged
>> and
>>>> one fifth.
>>>>
>>> Right.  But how do you know how much is the signal's magnitude reduced?
>>> And what is the factor to multiply the obtained spectrum to obtain
>>> signal's exact amplitude?  I really wish to obtain exact amplitude and
>>> not so much to get rid of sidelobes.
>> In the table in Harris's paper, look at the column entitled 'Coherent
>> Gain'.
>>
>> I'm glad someone provided a link to this paper - I have used it for many
>> years as a source of reference, but it was at work, so I couldn't remember
>> exactly where to find the figure you wanted when I made my earlier post.
>>
>> Jeff
>>> Marko
>>>
>>>
>
```
```Pygmalion wrote:
> OK, so it is a usual practice to use windowing, and then divide it with
> coherent gain in order to obtain real magnitude for oscillation?

In your case, you will always use windowing.  You are stuck with
one.  Your choice is rectangular or something else, not no window.

FFT's are applied to finite length vectors.  Thus unless your
complete signal is only of the same finite extent as the fft
aperture, or completely periodic with an fft aperture the happens
to be synchronous with the period, the window will cause artifacts.

The default rectangular window will convolve any non-bin
sinusoidal component with a sinc, thus munging its amplitude and
spreading its energy out across multiple bins, while leave a
bin-centered sinusoid unaffected (due to the shape of a sinc function).
Other shapes of window, will munge various frequencies to a greater
or lesser extent, usually munging non-bin frequencies less at the
cost of munging bin frequencies more.  None will directly give
you the uncorrected amplitude of all frequencies, bin and non-bin.

IMHO. YMMV.
--
rhn A.T nicholson d.0.t C-o-M

```
```Hi

I am having the problem with the amplitude correction also. I make
measurements in the freq. domain ,then I am going to the time domain and
cutting off the reflections. After this I am going back to freq. domain.
When applying the gain coherence coefficients from Harris paper, my
windowed signal amplitude is much greater than the one obtained with no
windowing.
If I dont use any correction for the amplitude, then the Dolph-Chebyshev
or Kaiser windows give lower results than the rectangular window. That
means everything is working fine except amplitude correction. How should I
apply this coherent gain coefficent ?

Regards,
Piotr

```
```On Jun 27, 6:07 am, "qhash" <piotr.kuch...@vp.pl> wrote:
> Hi
> ...
> How should I apply this coherent gain coefficent ?
>
> Regards,
> Piotr

Divide the windowed results by the coherent gain of the window.

For bin centered tones, this should give the same value for all
windows.

For tones halfway between bins the value should be reduced from
the bin centered value by the 'scallopping loss' parameter value
from Harris' paper.

Dale B. Dalrymple
http://dbdimages.com

```
```>On Jun 27, 6:07 am, "qhash" <piotr.kuch...@vp.pl> wrote:
>> Hi
>> ...
>> How should I apply this coherent gain coefficent ?
>>
>> Regards,
>> Piotr
>
>Divide the windowed results by the coherent gain of the window.
>
>For bin centered tones, this should give the same value for all
>windows.
>
>For tones halfway between bins the value should be reduced from
>the bin centered value by the 'scallopping loss' parameter value
>from Harris' paper.
>
>Dale B. Dalrymple
>http://dbdimages.com
>
Thanks a lot ! The 'scallopping loss' solves the problem. However this is
still "black magic" as I do not fully understand the bin centered tones
idea. My data is a random data ,radiation gathered by the NA through
waveguide from the antenna. How can I know that those signals are not bin
centered ? And why halfway ? Can't they be somewhere in-between ?

Also question about windowing. The gain I lose when I am using window
different from rectangular one is not constant along the spectrum ? So,
does the coherent gain coefficent gives back the oryginal amplitude or it
is burdened with some error ?

Best regards,
Piotr
```
```On Jun 30, 8:34 am, "qhash" <piotr.kuch...@vp.pl> wrote:
>
> ...
> So,
> does the coherent gain coefficent gives back the oryginal amplitude or it
> is burdened with some error ?
>
> Best regards,
> Piotr

For tones that happen to fall at bin center, the coherent gain
coefficient gives back the original amplitude. For frequencies that
fall off the bin center, the error can be as great as the scalloping
loss. The maximum error occurs if the frequency falls halfway between
bin centers.

Dale B. Dalrymple
http://dbdimages.com

```
```On Jun 30, 1:07 pm, dbd <d...@ieee.org> wrote:
> On Jun 30, 8:34 am, "qhash" <piotr.kuch...@vp.pl> wrote:
>
>
>
> > ...
> > So,
> > does the coherent gain coefficent gives back the oryginal amplitude or it
> > is burdened with some error ?
>
> > Best regards,
> > Piotr
>
> For tones that happen to fall at bin center, the coherent gain
> coefficient gives back the original amplitude. For frequencies that
> fall off the bin center, the error can be as great as the scalloping
> loss. The maximum error occurs if the frequency falls halfway between
> bin centers.
>
> Dale B. Dalrymplehttp://dbdimages.com

There's a description of amplitude correction (for sinusoidal tone
signals) in one of the B&K technical manuals which corrects for the
effects of windowing. First you determine the frequency by the peak of
the signal and the 2 surrounding FFT bins. Using these values you can
determine the frequency to more accuracy than the FFT bin width size.
Once you have the frequency you can then determine the amplitude
correction factor for that particular frequency. In the B&K  manual
they only do it explicitly for  something like a hamming window.

An generalized alternative is to precalculate the frequency/amplitude
corrections and put them in a table and interpolate to find the
corrections. This type of correction makes several assumptions.
1 - Signal of Interest is a pure sinusoid.
2 - High SNR, so noise contribution has little effect
3 - Leakage from other strong sinusoids is minimal.

An alternative is to use the Flattop window, which is designed so to
allow you to measure amplitude without any correction. Of course the
sidelobe behaviour isn't as good as some other windows.

Cheers,
David

```
```On Jun 30, 8:34 am, "qhash" <piotr.kuch...@vp.pl> wrote:
> >On Jun 27, 6:07 am, "qhash" <piotr.kuch...@vp.pl> wrote:
> >> Hi
> >> ...
> >> How should I apply this coherent gain coefficent ?
>
> >> Regards,
> >> Piotr
>
> >Divide the windowed results by the coherent gain of the window.
>
> >For bin centered tones, this should give the same value for all
> >windows.
>
> >For tones halfway between bins the value should be reduced from
> >the bin centered value by the 'scallopping loss' parameter value
> >from Harris' paper.
>
> >Dale B. Dalrymple
> >http://dbdimages.com
>
> Thanks a lot ! The 'scallopping loss' solves the problem. However this is
> still "black magic" as I do not fully understand the bin centered tones
> idea. My data is a random data ,radiation gathered by the NA through
> waveguide from the antenna. How can I know that those signals are not bin
> centered ?

Unless you are sampling synchronous to those signals,
they are unlikely to be bin centered.

> And why halfway ? Can't they be somewhere in-between ?

Yes.  Amplitude estimation involves frequency estimation.
You need to estimate where the peak of the window
transform of your sinusoid of interest is located to
determine how far down the sides of that transform curve
your DFT result points are located.  Then you can use
the inverse ratio (peak vs. data point locations) as your
amplitude correction factors.  You might even want to
separately correct the points on either side and take
a weighted average.

> Also question about windowing. The gain I lose when I am using window
> different from rectangular one is not constant along the spectrum ?

Yes.  The transform of any window (other than a 1 pt.
impulse) will not be completely flat in the frequency
domain.  However, there are windows that are flatter
near the peak, thus giving correction factors closer
to 1.0, but more susceptible to certain kinds of
interference in exchange.

> So,
> does the coherent gain coefficent gives back the oryginal amplitude or it
> is burdened with some error ?

It is burdened with the need for a frequency dependent
correction factor.

IMHO. YMMV.
--
rhn A.T nicholson d.0.t C-o-M
http://www.nicholson.com/rhn/dsp.html

```
```On Jul 9, 2:46 pm, "Ron N." <rhnlo...@yahoo.com> wrote:
> On Jun 30, 8:34 am, "qhash" <piotr.kuch...@vp.pl> wrote:
>
>
>
> > >On Jun 27, 6:07 am, "qhash" <piotr.kuch...@vp.pl> wrote:
> > >> Hi
> > >> ...
> > >> How should I apply this coherent gain coefficent ?
>
> > >> Regards,
> > >> Piotr
>
> > >Divide the windowed results by the coherent gain of the window.
>
> > >For bin centered tones, this should give the same value for all
> > >windows.
>
> > >For tones halfway between bins the value should be reduced from
> > >the bin centered value by the 'scallopping loss' parameter value
> > >from Harris' paper.
>
> > >Dale B. Dalrymple
> > >http://dbdimages.com
>
> > Thanks a lot ! The 'scallopping loss' solves the problem. However this is
> > still "black magic" as I do not fully understand the bin centered tones
> > idea. My data is a random data ,radiation gathered by the NA through
> > waveguide from the antenna. How can I know that those signals are not bin
> > centered ?
>
> Unless you are sampling synchronous to those signals,
> they are unlikely to be bin centered.
>
> > And why halfway ? Can't they be somewhere in-between ?

The halfway point between fft bins is used since it represents the
worst case loss. At the halfway point the power in adjacent FFT bins
is equal (for symmetric windows). If the frequency is lower then more
power goes to the lower FFT bin and less to the upper FFT bin. The
opposite happens when the frequency is increased.

Cheers,
David

```