DSPRelated.com
Forums

Blackman-Harris windows

Started by seb November 23, 2004
Hello,

Is someone know how to compute a Blakman-Harris windows ?

1) In Harris, F. J. "On the Use of Windows for Harmonic Analysis with
the Discrete Fourier Transform." Proceedings of the IEEE. Vol. 66
(January 1978)

w[n] = a0 - a1 * cos(2*pi/N*n) + a2 * cos(4*pi/N*n) - a3 *
cos(6*pi/N*n)
with 0 =< n <= (N - 1)      (NOT SYMETRIC !!!)

2) Matlab use 

w[n] = a0 - a1 * cos(2*pi/(N-1)*n) + a2 * cos(4*pi/(N-1)*n) - a3 *
cos(6*pi/(N-1)*n)
with 0 =< n <= (N - 1)       (SYMETRIC)
germain1_fr@yahoo.fr (seb) wrote 
> > Is someone know how to compute a Blakman-Harris windows ? > > 1) In Harris, F. J. "On the Use of Windows for Harmonic Analysis with > the Discrete Fourier Transform." Proceedings of the IEEE. Vol. 66 > (January 1978) > > w[n] = a0 - a1 * cos(2*pi/N*n) + a2 * cos(4*pi/N*n) - a3 * > cos(6*pi/N*n) > with 0 =< n <= (N - 1) (NOT SYMETRIC !!!) > > 2) Matlab use > > w[n] = a0 - a1 * cos(2*pi/(N-1)*n) + a2 * cos(4*pi/(N-1)*n) - a3 * > cos(6*pi/(N-1)*n) > with 0 =< n <= (N - 1) (SYMETRIC)
It depends on what you want. The harris paper assumes that you're going to take the FFT after applying the window to the data. If that's the case, the window should probably be periodic with period equal to your data length (N). That's what 1) is doing. 2) is generating a symmetric window, which is probably not what you want for spectral estimation. Ciao, Peter K.
Peter Kootsookos wrote:

> germain1_fr@yahoo.fr (seb) wrote > >>Is someone know how to compute a Blakman-Harris windows ? >> >>1) In Harris, F. J. "On the Use of Windows for Harmonic Analysis with >>the Discrete Fourier Transform." Proceedings of the IEEE. Vol. 66 >>(January 1978) >> >>w[n] = a0 - a1 * cos(2*pi/N*n) + a2 * cos(4*pi/N*n) - a3 * >>cos(6*pi/N*n) >>with 0 =< n <= (N - 1) (NOT SYMETRIC !!!) >> >>2) Matlab use >> >>w[n] = a0 - a1 * cos(2*pi/(N-1)*n) + a2 * cos(4*pi/(N-1)*n) - a3 * >>cos(6*pi/(N-1)*n) >>with 0 =< n <= (N - 1) (SYMETRIC) > > > It depends on what you want. > > The harris paper assumes that you're going to take the FFT after > applying the window to the data. If that's the case, the window > should probably be periodic with period equal to your data length (N). > That's what 1) is doing. > > 2) is generating a symmetric window, which is probably not what you > want for spectral estimation. > > Ciao, > > Peter K.
Harris probably uses zero-based indexing, like any sensible practitioner. Matlab doesn't. Jerry -- Engineering is the art of making what you want from things you can get. &#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;
Jerry Avins wrote:

>Peter Kootsookos wrote: > > > >>germain1_fr@yahoo.fr (seb) wrote >> >> >> >>>Is someone know how to compute a Blakman-Harris windows ? >>> >>>1) In Harris, F. J. "On the Use of Windows for Harmonic Analysis with >>>the Discrete Fourier Transform." Proceedings of the IEEE. Vol. 66 >>>(January 1978) >>> >>>w[n] = a0 - a1 * cos(2*pi/N*n) + a2 * cos(4*pi/N*n) - a3 * >>>cos(6*pi/N*n) >>>with 0 =< n <= (N - 1) (NOT SYMETRIC !!!) >>> >>>2) Matlab use >>> >>>w[n] = a0 - a1 * cos(2*pi/(N-1)*n) + a2 * cos(4*pi/(N-1)*n) - a3 * >>>cos(6*pi/(N-1)*n) >>>with 0 =< n <= (N - 1) (SYMETRIC) >>> >>> >>It depends on what you want. >> >>The harris paper assumes that you're going to take the FFT after >>applying the window to the data. If that's the case, the window >>should probably be periodic with period equal to your data length (N). >> That's what 1) is doing. >> >>2) is generating a symmetric window, which is probably not what you >>want for spectral estimation. >> >>Ciao, >> >>Peter K. >> >> > >Harris probably uses zero-based indexing, like any sensible >practitioner. Matlab doesn't. > >Jerry > >
Jerry, That's what I thought too, but I then noticed that Seb says that the variable n has a range 0 to (N-1), so 'sensible' indexing is in fact being used here, so that's not the answer. (As an aside, Matlab's convention of numbering the first element in an array as element 1, the second as element 2 etc., may be irritating to C programmers, but it does have an undeniable logic to it.) About the windows: Window (1) is fine for FFTs, because it results in low spectral leakage. [Should that be window 0 ? :=) ] Windowing using this function is, in effect, pure sinusoidal modulation of the 'continuous' time-domain signal that you get when you join up an unlimited number of segments containing N signal-samples. Window (2), being symmetric, is a good window to use when you are generating FIR filter coefficients because symmetrical windowing is necessary if you require a filter that has a linear phase-response. Regards, John
I believe that Peter K. has it right.  That is what I remember from DSP class 
as one of the assumptions underlying using the FFT.  I have used the a 
symmetrical window as in 2 to weight an sonar array where the assumption of a 
periodic signal is not applicable.  

In article <3fca8095.0411230621.7f47aaad@posting.google.com>, 
p.kootsookos@iolfree.ie (Peter Kootsookos) wrote:
>germain1_fr@yahoo.fr (seb) wrote >> >> Is someone know how to compute a Blakman-Harris windows ? >> >> 1) In Harris, F. J. "On the Use of Windows for Harmonic Analysis with >> the Discrete Fourier Transform." Proceedings of the IEEE. Vol. 66 >> (January 1978) >> >> w[n] = a0 - a1 * cos(2*pi/N*n) + a2 * cos(4*pi/N*n) - a3 * >> cos(6*pi/N*n) >> with 0 =< n <= (N - 1) (NOT SYMETRIC !!!) >> >> 2) Matlab use >> >> w[n] = a0 - a1 * cos(2*pi/(N-1)*n) + a2 * cos(4*pi/(N-1)*n) - a3 * >> cos(6*pi/(N-1)*n) >> with 0 =< n <= (N - 1) (SYMETRIC) > >It depends on what you want. > >The harris paper assumes that you're going to take the FFT after >applying the window to the data. If that's the case, the window >should probably be periodic with period equal to your data length (N). > That's what 1) is doing. > >2) is generating a symmetric window, which is probably not what you >want for spectral estimation. > >Ciao, > >Peter K.

John Monro wrote:

> (As an aside, Matlab's convention of numbering the first element in an > array as element 1, the second as element 2 etc., may be irritating to > C programmers, but it does have an undeniable logic to it.)
Only if you begin counting from one. In that case where does zero go? :-) I actually taught my daughter to begin counting from zero (and to ask the above question of her teachers as they inevitably began to train her out of it.) I was surprised how difficult it was for me to then give her a sensible explanation of why starting from one was the common way after she had internalized the zero origin of nature. The only logic I see in favor of one origin is that if you count things starting from one you end up with the number of things but attaching the number one to the first object should apply even in zero origin thinking. To make counting things the basis of a number system is primative. Bob -- "Things should be described as simply as possible, but no simpler." A. Einstein
On 2004-11-23 18:05:21 +0100, John Monro 
<johnmonro@delete.optusnet.com.au> said:

> (As an aside, Matlab's convention of numbering the first element in an > array as element 1, the second as element 2 etc., may be irritating to > C programmers, but it does have an undeniable logic to it.)
If that's the case, I don't see it. I just can't think of any logic that would be useful without the zero... -- Stephan M. Bernsee http://www.dspdimension.com
Bob Cain wrote:

> I actually taught my daughter to begin counting from zero
I like that ;)
> (and to ask the above question of her teachers as they > inevitably began to train her out of it.) I was surprised > how difficult it was for me to then give her a sensible > explanation of why starting from one was the common way > after she had internalized the zero origin of nature. > > The only logic I see in favor of one origin is that if you > count things starting from one you end up with the number of > things but attaching the number one to the first object > should apply even in zero origin thinking. To make counting > things the basis of a number system is primative.
There's a good article on the invention of Zero at http://www-gap.dcs.st-and.ac.uk/~history/HistTopics/Zero.html It explains that Zero evolved from a placeholder sign in ancient positional value systems and that its use as a proper number is much younger. The question remains why it still hasn't fully seeped in. Horror Vacui? Martin -- Quidquid latine dictum sit, altum viditur.
On 23 Nov 2004 06:21:15 -0800, p.kootsookos@iolfree.ie (Peter
Kootsookos) wrote:

>germain1_fr@yahoo.fr (seb) wrote >> >> Is someone know how to compute a Blakman-Harris windows ? >> >> 1) In Harris, F. J. "On the Use of Windows for Harmonic Analysis with >> the Discrete Fourier Transform." Proceedings of the IEEE. Vol. 66 >> (January 1978) >> >> w[n] = a0 - a1 * cos(2*pi/N*n) + a2 * cos(4*pi/N*n) - a3 * >> cos(6*pi/N*n) >> with 0 =< n <= (N - 1) (NOT SYMETRIC !!!) >> >> 2) Matlab use >> >> w[n] = a0 - a1 * cos(2*pi/(N-1)*n) + a2 * cos(4*pi/(N-1)*n) - a3 * >> cos(6*pi/(N-1)*n) >> with 0 =< n <= (N - 1) (SYMETRIC) > >It depends on what you want. > >The harris paper assumes that you're going to take the FFT after >applying the window to the data. If that's the case, the window >should probably be periodic with period equal to your data length (N). > That's what 1) is doing. > >2) is generating a symmetric window, which is probably not what you >want for spectral estimation. > >Ciao, > >Peter K.
Hi Dr. K, Yeow, ... seb has touched on a subject that's more complicated than he may realize. I call his equation 1) "DFT symmetric" because it's discrete Fourier transform (DFT) is real-only. I call his equation 2) "linear symmetric" because it's symmetrical if you plot it out on paper. However, the DFT of his equation 2) has a non-zero imaginary part! [Not to cause a screaming match here, but I think both window sequences, 1) & 2), are "symmetric" in their own special way.] So I agree with you. He should use 1) for spectral analysis, and he should use 2) for other purposes, for example windowing the coefficients of a nonrecursive FIR filter (in order to maintain a linear-phase filter). Of course, for large N the amplitude sample values of his 1) and 2) will be *very* similar. [-Rick-]
Stephan M. Bernsee <spam@dspdimension.com> wrote 

> If that's the case, I don't see it. I just can't think of any logic > that would be useful without the zero...
Let's see... this as a data stream: 111111111111111111111111 or this: 101100111100101001111111 Yes, I see what you mean. ;-) Ciao, Peter K.