# When is a "boxcar" window legitimate

Started by February 23, 2011
```I think I know 2 things about windowing:
1. Using an appropriate window can reduce smearing when
analyzing a signal by performing a DFT, DCT, or similar.
2. It works because it reduces any discontinuity of signal and
at least it's first derivative at start/end of sample when
considering it as one period of an infinitely repeating
signal.

*UNDERLYING _BASIC_ ASSUMPTION*
I wish to characterize a signal _solely_ by amplitude vs
frequency. There will be *NO* attempt (actually or by
implication) to reconstruct the signal. Throwing out phase
information will be the least of reasons for that qualification.

Least restrictive -
arbitrary start time, fixed duration
Less restrictive -
start on positive going zero crossing
end on positive going zero crossing
tweak results of bin by ratio of actual/nominal window width
Far out set of restrictions -;/
start on positive going zero crossing
end on positive going zero crossing
basis vector frequency chosen to be integral number of periods
tweak results of
bin by ratio of actual/nominal window width
bin center by ratio of actual/nominal window center

(and NO, I've not been a student for ~half century ;)

```
```On Feb 23, 11:08&#2013266080;pm, Richard Owlett <rowl...@pcnetinc.com> wrote:
> I think I know 2 things about windowing:
> &#2013266080; &#2013266080;1. Using an appropriate window can reduce smearing when
> &#2013266080; &#2013266080; &#2013266080; analyzing a signal by performing a DFT, DCT, or similar.
> &#2013266080; &#2013266080;2. It works because it reduces any discontinuity of signal and
> &#2013266080; &#2013266080; &#2013266080; at least it's first derivative at start/end of sample when
> &#2013266080; &#2013266080; &#2013266080; considering it as one period of an infinitely repeating
> &#2013266080; &#2013266080; &#2013266080; signal.

I had hoped we were done with that discussion for a couple
of years to come: The rectangular window is the basis building
block for the infinite pre- and post-padding-with-zeros
technique. Windowing function are not needed if you do the
periodic extension. In the latter case the computed numbers
correspond 1:1 with the desired numbers.

> *UNDERLYING _BASIC_ ASSUMPTION*
> I wish to characterize a signal _solely_ by amplitude vs
> frequency.

Can't be done using the DFT. Consider the monochromatic
sinusoidal with frequency k/N +1/2N  where N is the DFT
length and k is an integer, k < N/2.

In that case the sinusoidal maps onto every DFT coefficients,
which means that the amplitude information is distributed
across the whole DFT.

Rune
```
```Rune Allnor wrote:
> On Feb 23, 11:08 pm, Richard Owlett<rowl...@pcnetinc.com>  wrote:
>> I think I know 2 things about windowing:
>>     1. Using an appropriate window can reduce smearing when
>>        analyzing a signal by performing a DFT, DCT, or similar.
>>     2. It works because it reduces any discontinuity of signal and
>>        at least it's first derivative at start/end of sample when
>>        considering it as one period of an infinitely repeating
>>        signal.
>
> I had hoped we were done with that discussion for a couple
> of years to come: The rectangular window is the basis building
> block for the infinite pre- and post-padding-with-zeros
> technique. Windowing function are not needed if you do the
> periodic extension. In the latter case the computed numbers
> correspond 1:1 with the desired numbers.
>
>> *UNDERLYING _BASIC_ ASSUMPTION*
>> I wish to characterize a signal _solely_ by amplitude vs
>> frequency.
>
> Can't be done using the DFT. Consider the monochromatic
> sinusoidal with frequency k/N +1/2N  where N is the DFT
> length and k is an integer, k<  N/2.
>
> In that case the sinusoidal maps onto every DFT coefficients,
> which means that the amplitude information is distributed
> across the whole DFT.
>
> Rune

Thank you. I knew I had gaps in my background. Looks like they
are much larger than I thought.

```
```On 2/23/2011 2:08 PM, Richard Owlett wrote:
> I think I know 2 things about windowing:
>    1. Using an appropriate window can reduce smearing when
>       analyzing a signal by performing a DFT, DCT, or similar.
>    2. It works because it reduces any discontinuity of signal and
>       at least it's first derivative at start/end of sample when
>       considering it as one period of an infinitely repeating
>       signal.
and  3. It determines the basis functions that will be used in computing
an FFT - well, it *can* do that.  e.g. if the transform length is the
same as the window length (as is most usual) then the lowest frequency
sample will be at 1/NT where T is the sample interval in time. and NT is
the length of the window.

You have it right by saying that some windows smooth the edges.
Consider this:

If the signal being windowed has no energy around the end points then
having a rectangular window has little negative effect because no sharp
edges are created by windowing  .... which is not the same thing at all
as saying a "short window".

Your idea of grabbing the positive zero crossings is an attempt to get a
"better" window length relative to the "likely" frequency components of
the signal.  That way the FFT basis functions are more likely to "match"
what's in the signal. There are perhaps better ways to do that .. not
that I can think of one right now.

Fred

```
```Fred Marshall wrote:
> On 2/23/2011 2:08 PM, Richard Owlett wrote:
>> I think I know 2 things about windowing:
>> 1. Using an appropriate window can reduce smearing when
>> analyzing a signal by performing a DFT, DCT, or similar.
>> 2. It works because it reduces any discontinuity of signal and
>> at least it's first derivative at start/end of sample when
>> considering it as one period of an infinitely repeating
>> signal.
> and 3. It determines the basis functions that will be used in computing
> an FFT - well, it *can* do that. e.g. if the transform length is the
> same as the window length (as is most usual) then the lowest frequency
> sample will be at 1/NT where T is the sample interval in time. and NT is
> the length of the window.
>
> You have it right by saying that some windows smooth the edges.
> Consider this:
>
> If the signal being windowed has no energy around the end points then
> having a rectangular window has little negative effect because no sharp
> edges are created by windowing .... which is not the same thing at all
> as saying a "short window".
>
> Your idea of grabbing the positive zero crossings is an attempt to get a
> "better" window length relative to the "likely" frequency components of
> the signal. That way the FFT basis functions are more likely to "match"
> what's in the signal. There are perhaps better ways to do that .. not
> that I can think of one right now.
>
> Fred
>
>

Thanks. Due you, Rune, and Chris Bore I should be waring out
Google for the next .... or so.

```
```On Feb 26, 4:09&#2013266080;am, Fred Marshall <fmarshallxremove_th...@acm.org>
wrote:
> On 2/23/2011 2:08 PM, Richard Owlett wrote:> I think I know 2 things about windowing:
> > &#2013266080; &#2013266080;1. Using an appropriate window can reduce smearing when
> > &#2013266080; &#2013266080; &#2013266080; analyzing a signal by performing a DFT, DCT, or similar.
> > &#2013266080; &#2013266080;2. It works because it reduces any discontinuity of signal and
> > &#2013266080; &#2013266080; &#2013266080; at least it's first derivative at start/end of sample when
> > &#2013266080; &#2013266080; &#2013266080; considering it as one period of an infinitely repeating
> > &#2013266080; &#2013266080; &#2013266080; signal.
>
> and &#2013266080;3. It determines the basis functions that will be used in computing
> an FFT - well, it *can* do that. &#2013266080;e.g. if the transform length is the
> same as the window length (as is most usual) then the lowest frequency
> sample will be at 1/NT where T is the sample interval in time. and NT is
> the length of the window.

Wrong.

First of all, you didn't define the domain of the FT.
In the case of an *infinite* length discrete time FT,
the transform becomes (view with fixed-width font)

inf
X(w) = sum    x[n] exp(-jwn).
n=-inf

End of story.

The basis functions exp(-jwn) ar continuous in w and
defined for the whole domain of n. No leeway or choises,
whatsoever, available to the analyst.

Rune
```
```On 2/27/2011 10:52 PM, Rune Allnor wrote:
>> On Feb 26, 4:09 am, Fred Marshall wrote:

>> >  and  3. It determines the basis functions that will be used in computing
>> >  an FFT - well, it*can*  do that.  e.g. if the transform length is the
>> >  same as the window length (as is most usual) then the lowest frequency
>> >  sample will be at 1/NT where T is the sample interval in time. and NT is
>> >  the length of the window.

> Wrong.
>
> First of all, you didn't define the domain of the FT.
> In the case of an*infinite*  length discrete time FT,
> the transform becomes (view with fixed-width font)
>
>         inf
> X(w) = sum    x[n] exp(-jwn).
>        n=-inf
>
> End of story.
>
> The basis functions exp(-jwn) ar continuous in w and
> defined for the whole domain of n. No leeway or choises,
> whatsoever, available to the analyst.
>
> Rune

Hmmmm....  OK, let's see here:

I speak of the "transform length" so plugging in "inf" seems a bit weird
to me.  But, just to be clear, I was referring to a Finite transform.

In the case you give:

>         inf
> X(w) = sum    x[n] exp(-jwn).
>        n=-inf

w is continuous and infinite which is fine in this discussion.
sum on n is obviously discrete.
Because x(n) is discrete then X(w) is periodic on 1/T=fs
(this suggests a simplification of the sum)
no arguments here, just stating facts

And, I was thinking and writing in the context of a Discrete transform -
which may have been off-topic (I'm not sure what Richard's context)
- and I wasn't clear re: my context.

So, if we're talking about sampled data / discrete finite sequences then
there's a direct relationship between the window length and the
frequency sample interval.  What I was trying to say, simply, is that
the samples at 1/NT and -1/NT (or, if you like: (fs-1/NT) represent THE
lowest frequency sinusoid in time which is at fs/NT (not 1/NT as I
stated earlier). ... I think that's right now.
Since NT is the window length then it determines (along with fs which I
assumed was already established) this lowest frequency.

Fred
```
```Fred Marshall wrote:
> On 2/27/2011 10:52 PM, Rune Allnor wrote:
>[snip]
>
> And, I was thinking and writing in the context of a Discrete transform -
> which may have been off-topic (I'm not sure what Richard's context)
> - and I wasn't clear re: my context.
>
I live in one of two separate 'domains' ;/
1. Either continuous in all domains
2. digitally discrete signals sample at a discrete times for
a finite number of signals with explicitly no knowledge of
what happens outside of sample interval. Hoping that
approximations make a satisfactory approximation to #1.
Yes - no guarantees.

```
```On Feb 28, 5:36&#2013266080;pm, Fred Marshall <fmarshallxremove_th...@acm.org>
wrote:
> On 2/27/2011 10:52 PM, Rune Allnor wrote:
>
>
>
>
>
> >> On Feb 26, 4:09 am, Fred Marshall wrote:
> >> > &#2013266080;and &#2013266080;3. It determines the basis functions that will be used in computing
> >> > &#2013266080;an FFT - well, it*can* &#2013266080;do that. &#2013266080;e.g. if the transform length is the
> >> > &#2013266080;same as the window length (as is most usual) then the lowest frequency
> >> > &#2013266080;sample will be at 1/NT where T is the sample interval in time. and NT is
> >> > &#2013266080;the length of the window.
> > Wrong.
>
> > First of all, you didn't define the domain of the FT.
> > In the case of an*infinite* &#2013266080;length discrete time FT,
> > the transform becomes (view with fixed-width font)
>
> > &#2013266080; &#2013266080; &#2013266080; &#2013266080; inf
> > X(w) = sum &#2013266080; &#2013266080;x[n] exp(-jwn).
> > &#2013266080; &#2013266080; &#2013266080; &#2013266080;n=-inf
>
> > End of story.
>
> > The basis functions exp(-jwn) ar continuous in w and
> > defined for the whole domain of n. No leeway or choises,
> > whatsoever, available to the analyst.
>
> > Rune
>
> Hmmmm.... &#2013266080;OK, let's see here:
>
> I speak of the "transform length" so plugging in "inf" seems a bit weird
> to me. &#2013266080;But, just to be clear, I was referring to a Finite transform.

You weren't clear. Now you have cleared things up. A bit. In the case
of the DFT I don't understand why you want to discuss window lengths
in relation to basis functions.

> In the case you give:
>
> &#2013266080;> &#2013266080; &#2013266080; &#2013266080; &#2013266080; inf
> &#2013266080;> X(w) = sum &#2013266080; &#2013266080;x[n] exp(-jwn).
> &#2013266080;> &#2013266080; &#2013266080; &#2013266080; &#2013266080;n=-inf
>
> w is continuous and infinite which is fine in this discussion.
> sum on n is obviously discrete.
> Because x(n) is discrete then X(w) is periodic on 1/T=fs

Where did T = 1 /fs come from? None of those factors appear in
the DTFT expression Istated.

> (this suggests a simplification of the sum)
> no arguments here, just stating facts

No. Introducing ad hoc factors. T and fs don't appear in the
expression for either the DTFT or the DFT.

> And, I was thinking and writing in the context of a Discrete transform -
> which may have been off-topic (I'm not sure what Richard's context)
> - and I wasn't clear re: my context.

OK. Richard wasn't clear, so I'll accept that.

> So, if we're talking about sampled data / discrete finite sequences then
> there's a direct relationship between the window length and the
> frequency sample interval.

Now you are contradicting yourself. At the start you said you
were considering the DFT. Now you don't. 'Frequency Sampling'
is one of several methods to relate the computed results from
the DFT to the desired results of the DTFT.

Which variant are you talking about now?

> &#2013266080;What I was trying to say, simply, is that
> the samples at 1/NT and -1/NT (or, if you like: (fs-1/NT) represent THE
> lowest frequency sinusoid in time which is at fs/NT (not 1/NT as I
> stated earlier). ... I think that's right now.
> Since NT is the window length then it determines (along with fs which I
> assumed was already established) this lowest frequency.

Again, fs and T don't appear in the FT expression I stated.
Where did they come from? Why are they important?

Remember, we are discussing the FT.

Rune
```