DSPRelated.com
Forums

Window functions

Started by Rune Allnor August 31, 2004
> Anyway, I'm thinking that there are two different types of > symmetry: "linear symmetry" and "DFT symmetry". And > that window functions should always be "DFT Symmetric". > And maybe I should change the equations in my book with > regard to the Hanning and Hamming windows.
Rick, One of my colleagues read your post and commented that your concepts of linear and DFT symmetry are nicely discussed in S. Martucci, "Symmetric convolution and discrete sine and cosine transforms," IEEE Transactions on Signal Processing, volume SP-42, no. 5, pp. 1038--1051, May 1994. I have not read the Martucci paper myself but I know my colleague is a big fan of it. Hope this helps, David
Hi Rick,

Do you have some list of errors/typos in your book?

Ishtiaq.

> But speaking of windows, I'm beginning to believe that > my equations for the Hanning and Hamming windows > are incorrect!
"Fred Marshall" <fmarshallx@remove_the_x.acm.org> wrote in message news:<OvOdnWOhrfOcj6vcRVn-og@centurytel.net>...
> > Rune, > > The windowing approach doesn't lend itself to going directly to filter > characteristics. The windowing approach is handy in some situations but > imprecise. That's why the Parks-McClellan program is so prevalent. > > The paper I wrote with Temes and Barcilon dealt with things like rise time, > rise time without over/undershoot, etc. Otherwise, I view the minimax > design of windows as exactly the same problem as the minimax design of > filters. If you can design a window using a numerical method, then you can > just as easily design a filter.
That sounds reasonable.
> Maybe looking more carefully at the Kaiser window and its parameters would > give you more insight.
Perhaps I don\t have access to the "useful" papers. My Kaiser code was concocetd from stuff I found in Proakis & Manolakis' as well as Oppenhem & Schafer's 1999 book. But ethe most useful contribution was found in the book by Hamming: "Digital Filters", 3rd ed., Dover, 1998. Hamming provided a pseudocode for a recursive implementation of that infamous I_0(x) function that goes into the Kaiser window. The code was quick to implement (I did it in less than 5 min) and it checked to within nine significant digits with the listed values in Abramowitz and Stegun.
> I often think of the windowing process as a convolution in frequency. Start > with a "perfect" lowpass filter with response 1 1 1 1 1 0 0 0 0 0 0 0 1 1 1 > 1. You know that the time window is a sinc and that's probably not what you > want because there will be temporal aliasing. Thus the need for a window. > > By windowing in time, you will convolve the frequency response with the > frequency sinc-like function that has a time "window" of the sort we're > discussing here. If you can envision the convolution being computed, you > can envision how sidelobes in the window frequency response affect the > resulting filter response. - It's just not a very precise picture..... > > Here's what I glean from this: > - the higher the sidelobes of the frequency domain version of the window, > the higher the ripples resulting in the convolved filter.
Agreed.
> - the wider the main lobe of the frequency domain version of the window, the > wider the transition regions of the convolved filter.
Agreed. Here's how I think of it. My teacher in engineering school wanted us to pick a window length such that the main lobe of the window spectrum fitted inside the transition band of the spec. This way one over-estiamtes the order of the filter, and can perhaps use this "brute" filter as a starting point, and tweak the parameters to fit better with a lower order. What is left unspecified is the ripple in pass- and stop-bands. The Kaiser window allows one to specify stop-band attenuation. As far as I can see, all windows leave the pass-band ripple unspecified.
> Because the result is a convolution, the window characteristics in frequency > are averaged out by the ideal filter function. So, precise window > characteristics are softened by that "filtering" process. In other words, > maybe it doesn't matter as much as one might think - unless you have very > precise filter specifications indeed!
I am aware of all that. I have this habit of having the computer do as much as the drudgery as possible. If there are simple formulas/estimates available for initial parameters, why not use them. I don't care if what I do with a 95 tap Kaiser filter can be achieved by a 49 tap optimum filter. I just try to avoid ending up with a 195 tap Kaiser filter...
> I hope this helps.... > > PS: van der Maas derived a continuous function that starts with a given main > lobe width between first zeros and computes the minimax sidelobe level going > to +/- infinity. The sidelobes going to infinity are a sinusoid - so the > edges of the window have corresponding dirac functions. Because this isn't > physically realizable, Dolph and Taylor and others came up with > approximations to the van der Maas function that *are* physically > realizable. And, was Dolph doing it for discrete arrays? I think so .... > > Most of the literature is in antenna theory.
Thanks. Rune
Jim Thomas <jthomas@bittware.com> wrote in message news:<10jbiuq31ic1u70@corp.supernews.com>...
> Rune Allnor wrote: > > Suffice it to say that I got very embarrased when I saw the filtered > > data this student got out of it. There were nothing visible in his > > plots that I did not see in my own, but his looked much more "crisp" > > while mine were very crude. > > Sounds to me like: > a) this student was standing on the shoulders of giants, and
Well, the student certainly stood on the shoulders of a couple of giants. He worked at the same lab where I were when I wrote my PhD, and had a supervisor who wrote his PhD at the same time I wrote mine. This guy, and two or three other guys at the lab, are certainly to be reckoned amongst giants. As for myself, I formally had nothing to do with this MSc student, but since he worked with my old stuff, I was invited to join in once or twice, in their discussions.
> b) Rune is one of the giants.
Thanks for the kind words. I am not sure I agree with you in this, but thanks.
> It's great that you see (and take) an opportunity to improve your > knowledge, but I don't think you should be embarrassed.
Well, if you have read my posts of the past, you might have seen that I can get pretty vocal about people who do not know (or use) the basic knowledge and skills in their trades or craft. Here I was, well down the road to making the same mistake myself.... embarrasing. Rune
r.lyons@_BOGUS_ieee.org (Rick Lyons) wrote in message news:<41365058.204625031@news.sf.sbcglobal.net>...
 
> But speaking of windows, I'm beginning to believe that > my equations for the Hanning and Hamming windows > are incorrect! > > My N-point Hamming equation, for example, is: > > w1(n) = 0.54 - 0.46*cos(2*pi*n/(N-1)) [1] > for n = 0,1,2,...,N-1. > > My Eq. [1] agrees, by the way, with Proakis & Manolakis, > Opp & Schafer, MATLAB, etc. > > If you plot the w1(n) samples in [1] give ya' this nice > symmetrical window sequence where the first and last > samples are both zero-valued. However, I just discovered > (maybe I knew this years ago and forgot) that the Fourier > transform of Eq. [1]'s w1(n) does *not* give us the > correct Fourier transform of a Hamming window!! > > The correct N-point discrete Fourier transform (DFT) of an > N-point Hamming window is three real non-zero samples. > The amplitudes of those samples are 0.23N, 0.54N, and > 0.23N. The imaginary part of the correct N-point DFT of > an N-point Hamming window is all zeros. > > The DFT of Eq. [1]'s w1(n) is neither real-only nor does > it's freq-domain samples have the correct amplitudes. > > I now think the correct N-point Hamming equation > should be: > > w2(n) = 0.54 - 0.46*cos(2*pi*n/(N)) [2] > for n = 0,1,2,...,N-1. > > If you plot w2(n) in the time domain it does not "look > symmetric". The w2(n) sequence's first and last samples > are not equal. But the DFT of Eq. [2]'s w2(n) is real-only > and it's freq-domain samples do have the correct amplitudes > (0.23N, 0.54N, and 0.23N). > > I want to call w2(n) "DFT symmetric", because if we circularize > (is that a word) it, by repeating it over and over, making > it periodic, then it becomes symmetrical. > > I know I know, the difference between w1(n) and w2(n) becomes > smaller and smaller as N becomes larger. > > Anyway, I'm thinking that there are two different types of > symmetry: "linear symmetry" and "DFT symmetry". And > that window functions should always be "DFT Symmetric". > And maybe I should change the equations in my book with > regard to the Hanning and Hamming windows. > > OK, this my rant of the day. > See Ya',
N instead of (N-1)... there are N points in the sequence, and one does want the end points to be equal, so we want the period of the cosine term to be N. The terms themselves, however, are indexed 0,...,N-1. It sounds reasonable, doesn't it? My immediate reaction is that this is the sort of set-up that potentially involves a disaster. I have done too much conversions between C (where indexes of an N-point sequence start at 0 and ends at N-1) and matlab (where the indexes start at 1 and ends at N) to underestimate the FUBAR-potential of the conversion of indexes. I am tempted to agree with you. It only takes one sloppy author once, to get the wrong expression in print, and everybody else copies that without checcking the details. It might interest you to learn that Hamming himself writes [1, p 119]: "... the 'Hamming window' ... has the coefficients 0.23, 0.54, 0.23, instead of the von Hann coefficients 0.25, 0.5, 0.25." and the von Hann window function is defined [1, eq. 5.7-1] as w[n] = 0.5*(1-cos(2*pi*k/N)) |k| <= N. It's too early in the morning for me to attempt to work out if they check out with the "standard" forms of the window functions or if you are right. Rune [1] Hamming: "Digital Filters", 3rd ed., Dover, 1998
"Fred Marshall" <fmarshallx@remove_the_x.acm.org> wrote in message news:<OvOdnWOhrfOcj6vcRVn-og@centurytel.net>...

> The paper I wrote with Temes and Barcilon
I checked with IEEExplore, and found one paper by Marshall & Temes, a few papers by Temes & Barcilon, but nothing with all three authors. Do you have a full reference for this paper? Rune
r.lyons@_BOGUS_ieee.org (Rick Lyons) wrote in message news:<41365058.204625031@news.sf.sbcglobal.net>...
> The DFT of Eq. [1]'s w1(n) is neither real-only nor does > it's freq-domain samples have the correct amplitudes. > > I now think the correct N-point Hamming equation > should be: > > w2(n) = 0.54 - 0.46*cos(2*pi*n/(N)) [2] > for n = 0,1,2,...,N-1. > > If you plot w2(n) in the time domain it does not "look > symmetric". The w2(n) sequence's first and last samples > are not equal. But the DFT of Eq. [2]'s w2(n) is real-only > and it's freq-domain samples do have the correct amplitudes > (0.23N, 0.54N, and 0.23N). > > I want to call w2(n) "DFT symmetric", because if we circularize > (is that a word) it, by repeating it over and over, making > it periodic, then it becomes symmetrical.
It's lunchtime and my head is not quite as foggy as when I made my first attempt at answering your post this morning: Should't you use a N-1 pt DFT and leave one end-point out of it? If so, the formulas are correct, and the end points of the windows appear twice in an analysis where they should appear only once. Could this account for the apparent error? Rune
On Thu, 2 Sep 2004 03:10:19 +0000 (UTC), gelbart@ICSI.Berkeley.EDU
(David Gelbart) wrote:

>> Anyway, I'm thinking that there are two different types of >> symmetry: "linear symmetry" and "DFT symmetry". And >> that window functions should always be "DFT Symmetric". >> And maybe I should change the equations in my book with >> regard to the Hanning and Hamming windows. > >Rick, > >One of my colleagues read your post and commented that >your concepts of linear and DFT symmetry are nicely >discussed in > >S. Martucci, "Symmetric convolution and discrete sine and cosine >transforms," IEEE Transactions on Signal Processing, volume SP-42, no. 5, >pp. 1038--1051, May 1994. > >I have not read the Martucci paper myself but I know my colleague >is a big fan of it. > >Hope this helps, >David
Hi David, Thanks ... I was able to take a look at the Martucci paper. I was thinking about two "kinds" of symmetry for sequences, and perhaps two different "lengths" (odd & even) for sequences. So in my head I thought "there may well be four different types of 'symmetric' periodic sequences to think about". Martucci shows 16 types of periodic sequences. That's right, sixteen!! Sheece. DSP, ... for me there seems to be no end to its little surprises that, now and then, bonk me right on the head. It'll take me a while to absorb some of the info in Martucci's paper, but I'm gonna try. Thanks a lot, David, for pointing out the Martucci paper to me. Regards, [-Rick-]
On Thu, 2 Sep 2004 13:23:02 +0900, "I. R. Khan" <ir_khan@hotmail.com>
wrote:

>Hi Rick, > >Do you have some list of errors/typos in your book? > >Ishtiaq. > >> But speaking of windows, I'm beginning to believe that >> my equations for the Hanning and Hamming windows >> are incorrect!
Hi, yes I do. Send me an E-mail telling which edition of the book, and which "Printing", you have. Then I'll be happy to E-mail the appropriate errata to you. As for my E-mail address, delete the two underscores ("_") and the letters between them. [-Rick-]
"Rune Allnor" <allnor@tele.ntnu.no> wrote in message
news:f56893ae.0409012307.76162892@posting.google.com...
> "Fred Marshall" <fmarshallx@remove_the_x.acm.org> wrote in message
news:<OvOdnWOhrfOcj6vcRVn-og@centurytel.net>...
> > > The paper I wrote with Temes and Barcilon > > I checked with IEEExplore, and found one paper by Marshall & Temes, > a few papers by Temes & Barcilon, but nothing with all three authors. > > Do you have a full reference for this paper?
"The Optimization of Bandlimited Sytems" Proc IEEE Vol 61 No. 2 Feb 1973 pp 196-234.