Hi Could anyone explain the Hamming window in REALLY simple terms and why it is useful and how it could be implemented in MATLAB?? I would be grateful for any response.

# Hamming window

Started by ●February 19, 2006

Posted by ●February 19, 2006

"rajgerman" <rajgerman@msn.com> wrote in message news:Ju6dnZUigbhAfmXenZ2dneKdnZydnZ2d@giganews.com...> Hi > > Could anyone explain the Hamming window in REALLY simple terms and why it > is useful and how it could be implemented in MATLAB?? > > I would be grateful for any response. >http://www.math.psu.edu/local_doc/matlab/toolbox/signal/hamming.html#1557 Best of luck - Mike

Posted by ●February 19, 2006

rajgerman wrote:> Hi > > Could anyone explain the Hamming window in REALLY simple terms and why it > is useful and how it could be implemented in MATLAB?? > > I would be grateful for any response.If you have the Signal Processing Toolbox, a Hamming window of length N can be obtained from Matlab as follows: w=hamming(N) Window functions like Hamming are typically applied as a point by point multiplication to the input of an FFT to control the level of adjacent spectral artifacts that appear in the magnitude of the FFT results for the case when the input frequencies do not correspond exactly with bin centers. These artifacts are referred to as leakage. Another common use for window functions is in the design of FIR filters using the window method. In this case a sinx/x lowpass function is multiplied point by point by a window to alter the frequency response of the filter. Google returns loads of useful information about window functions. Any introductory DSP book will discuss them as well. John

Posted by ●February 19, 2006

Thanks for that information but I'm still a little confused. The thing is I have a brain signal which is an audio file which I have fast fourier transformed. Now what I have to do is apply the Hamming window to that. How would I do that using MATLAB?? It seems confusing.

Posted by ●February 19, 2006

Hi, You can think of windowing in general as a convolution in frequency domain (you are multiplying both functions in the time domain). The result of this convolution on frequency domain is that samples outside one frequency affect the amplitude value at that frequency ! Ideally you would want your window to be an impulse in frequency domain, but note that you window would require infinite points in time.Thinking in frequency domain: So the goal of windowing can be thought as two fold, where we are trying to approximate the impulse in frequency domain with finite points: 1)Make the pass region of the window as narrow as possible. 2)Attenuate the other regions as much as possible The Hanning window does #2 pretty good, and you can get #1 to desired amount by increasing sample size. The rectangular window (which is the window you actually use if you don't multiply your data signal at all) is the best one on #1 (has the narrowest pas region), but is the worst on #2 ( largest amount of leakage). Check the posts above for implementation + additional info. Let me know if this is not clear. -Ikaro

Posted by ●February 19, 2006

rajgerman wrote:> Thanks for that information but I'm still a little confused. > > The thing is I have a brain signal which is an audio file which I have > fast fourier transformed.Why on earth? Are you sure there isn't something you misunderstood? Now what I have to do is apply the Hamming> window to that. How would I do that using MATLAB?? It seems confusing.Jerry -- Engineering is the art of making what you want from things you can get. �����������������������������������������������������������������������

Posted by ●February 20, 2006

"rajgerman" <rajgerman@msn.com> wrote in message news:qdidnQ5Hzq7-bWXe4p2dnA@giganews.com...> Thanks for that information but I'm still a little confused. > > The thing is I have a brain signal which is an audio file which I have > fast fourier transformed. Now what I have to do is apply the Hamming > window to that. How would I do that using MATLAB?? It seems confusing. >It's not likely that you want to window the FFTd sequence - as in multiply the FFTd sequence. It's much more likely that you want(ed) to window the temporal sequence (as in multiply) before the FFT. Or you could convolve in frequency to get the same affect. You have a few choices: 1) Generate the temporal window function. Someone has suggested how to do this in MATLAB. The window should be the same length as the temporal record you have unless you're processing in blocks. Then, either: Using the temporal record, multiply point by point by the window function in time. Then FFT if you need to. Using the FFT record that you have, IFFT it and proceed as above. FFT both the temporal data sequence and the temporal window. Convolve the two in frequency. Fred

Posted by ●February 20, 2006

rajgerman wrote:> Hi > > Could anyone explain the Hamming window in REALLY simple terms and why it > is useful and how it could be implemented in MATLAB?? > > I would be grateful for any response. > >Radjerman, Assume we have a set of time-domain samples, that have been taken from a signal waveform (if we are going to perform a FFT) or have been calculated from a desired impulse-response function )if we are going to implement a FIR filter.) When we selected the set of time-domain samples the selection process was in effect a 'chopping up' process that introduced high-frequency components that were not present originally in the continuously-sampled signal or in the unlimited impulse-response. These introduced components show up as high-frequency peaks in the FFT or as high-frequency peaks in the response of the FIR filter, both effects are generally undesirable. We can reduce the amplitude of these high-frequency components by 'tapering off' the amplitudes of the samples towards each end of the set in some systematic way, and the Hamming window is one of many similar functions that will do this job for us. If you look at the expression for a Hamming window you will see that if we multiply a set of signal samples by this function, the sample(s) at the centre of the set gets multiplied (or 'windowed')by the largest factor and this factor decreases in a smooth sinusoidal fashion as we go away from the centre, with the samples at each end being multiplied by zero. The end result is that instead of an abruptly 'chopped' set of samples we now have a set of samples that has been heavily modulated by one cycle of a sinusoidal function. The artifacts produced by this modulation are less objectionable for many applications. In the FFT the artifacts show up as spectral 'leakage' into adjacent frequency bins. In a FIR filter the pass-band response is altered sightly. In MATLAB, generate a set of values using the expression for the Hamming window function. Then generate the dot product between the set of Hamming window values and the set of signal samples. Regards, John

Posted by ●February 20, 2006

> > It's not likely that you want to window the FFTd sequence - as in multiply > the FFTd sequence. > It's much more likely that you want(ed) to window the temporal sequence > (as in multiply) before the FFT. > Or you could convolve in frequency to get the same affect. > > FFT both the temporal data sequence and the temporal window. > Convolve the two in frequency. >Hello Fred, Since the Hamming window is defined in terms of cosines, the Freq domain version turns out to have only 3 non-zero coefs. This makes for a pretty easy convolution. The coefs are -0.23, 0.54, -0.23 Clay

Posted by ●February 20, 2006

So are you saying that I do not need to fast fourier transform the audio signal, but apply the hamminng window first and the nfast fourier transform?? Sorry guys but I'm not to familiar with these topics but thanks for your help. If any of you would provide me their email address I could send you the files to show you what I mean.