Prev: Pulse shaping + interpolation
Next: FFT in OpenCV
From: Fred Marshall on 20 Feb 2006 14:59 "rajgerman" <rajgerman(a)msn.com> wrote in message news:MvOdnVwHToa4QWTenZ2dnUVZ_sadnZ2d(a)giganews.com... > >What Fred and I each have said, is that you may either: >> >>1) multiply your data on a sample by sample basis by the samples > comprising >>the Hamming window and then FFT the product. >> >>or >> >> >>2) convolve your FFTed data with the 3 coefs -0.23, 0.54, -0.23 that are > >>the frequency domain version of the Hamming window. You will need to know > >>how your FFT orders its data so the convolution can be applied properly. >> >> > > Cheers Clay > > I think I much better idea now. How would I though convolve the FFTed data > with the 3 coefs -0.23, 0.54, -0.23?? > > My FFTed data is Y = fft(y); In matlabese: FFTed Hamming window W = fft(w) = [-0.23 0.54 -0.23] where "w" is the Hamming window for the length of the sequence .. same length as length(y) conv(W,Y) Fred
From: Clay S. Turner on 20 Feb 2006 15:34 "Bob Cain" <arcane(a)arcanemethods.com> wrote in message news:dtd4vh0a6a(a)enews2.newsguy.com... >> >> 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 > > The three coeficients aren't real are they? The center one is but I seem > to remember that the side ones were complex. False memory? > > > Bob > -- Hello Bob, Yes the 3 coefs are real since the Hamming window is defined as Hamming(n,N) = 0.54-0.46*cos(2*pi*n/N) And by inspection one can see we have a DC term and a cosine term. Since both of these are even functions, The hermitian symmetry relations tell us that the Fourier transform wil be purely real. Now there is a point of hair splitting with the defn in that if we let "n" go from 0 to N in the Hamming window defn, then we are mixing the idea of N+1 samples into something that has period N. And this can lead to the components associated with frequencies of -1 and 1 having complex coefs although the imaginary parts will be small for N not small. If I use the 1st N terms from the Hamming defn, then its FT (period N) is purely real with only three nonzero terms. If I use N+1 terms and then FT them (with period N+1), I will get complex data across the whole range with just 3 terms being non-negligible. Clay
From: rajgerman on 20 Feb 2006 16:19 > >> >> Cheers Clay >> >> I think I much better idea now. How would I though convolve the FFTed data >> with the 3 coefs -0.23, 0.54, -0.23?? >> >> My FFTed data is Y = fft(y); > > > >If your FFT is like most, the output vector is in an order like > >0,1,2,3,...,N/2,-N/2+1,-N/2+2,-N/2+3,...-3,-2,-1 > >where the numbers above are the frequencies. Other FFTs may have the output >in an order like > >-N/2+1,-N/2+2,-N/2+3,...,-3,-2,-1,0,1,2,3,...,N/2 > >In both of these cases I've assumed the length N is even. You will need to >know how yours is done. > > >Now the convolution goes likes this > >new H(0) equals 0.54*H(0) - 0.26*(H(-1)+H(1)) > >new H(1) equals 0.54*H(1) - 0.26*(H(0)+H(2)) > >new H(2) equals 0.54*(H(2) - 0.26*(H(1)+H(3)) > >and so on. Whenever the index exceeds N/2 just wrap it back around. For >example N/2+1 becomes -N/2+1. Be careful to not use the new value as an >input in one of the calculations. All of the inputs are the old values. > > >IHTH, >Clay My ffted data are all complex values. size(Y) = ans = 88200 1 These are the first 10 values of my ffted data: 0.0001 - 0.0000i 0.0002 + 0.0001i 0.0000 + 0.0001i -0.0000 + 0.0001i -0.0000 - 0.0000i 0.0001 + 0.0001i -0.0002 + 0.0001i 0.0000 - 0.0000i 0.0000 - 0.0000i 0.0002 + 0.0002i So does that mean H(0) = 0.0001 - 0.0000i and so on .........??
From: rajgerman on 20 Feb 2006 16:23 >Hi there, > >I you plan on analyzing your signal in MATLAB then you can use the >function PWELCH to estimate the power spectrum density of your signal. >This function automatically implements the hanning window and estimates >the PSD for you (as well as plot it): > >http://www.mathworks.com/access/helpdesk/help/toolbox/signal/pwelch.html > >This estimate is much better than a simple periodogram. Note that you >need the Signal Processing Toobox to use it... > >You can send me the files if you want me to take a look. > >-ikaro > > Cheers Ikaro For now I have to use the hamming window. But later on I will make use of the welch method. Are the Hann/Hanning and Hamming window the same thing?? I have read that they are almost similar.
From: Rick Lyons on 22 Feb 2006 06:04
On Mon, 20 Feb 2006 11:36:13 -0500, "Clay S. Turner" <Physics(a)Bellsouth.net> wrote: > >> >> Cheers Clay >> >> I think I much better idea now. How would I though convolve the FFTed data >> with the 3 coefs -0.23, 0.54, -0.23?? >> >> My FFTed data is Y = fft(y); > > > >If your FFT is like most, the output vector is in an order like > >0,1,2,3,...,N/2,-N/2+1,-N/2+2,-N/2+3,...-3,-2,-1 > >where the numbers above are the frequencies. Other FFTs may have the output >in an order like > >-N/2+1,-N/2+2,-N/2+3,...,-3,-2,-1,0,1,2,3,...,N/2 > >In both of these cases I've assumed the length N is even. You will need to >know how yours is done. > > >Now the convolution goes likes this > >new H(0) equals 0.54*H(0) - 0.26*(H(-1)+H(1)) > >new H(1) equals 0.54*H(1) - 0.26*(H(0)+H(2)) > >new H(2) equals 0.54*(H(2) - 0.26*(H(1)+H(3)) > >and so on. Whenever the index exceeds N/2 just wrap it back around. For >example N/2+1 becomes -N/2+1. Be careful to not use the new value as an >input in one of the calculations. All of the inputs are the old values. > > >IHTH, >Clay Hi Clay, I sure like your description. Very nice. We might also mention to rajgerman that: (1) if he uses a hanning window, the freq-domain convolutions can performed with binary right shifts and avoid multiplications altogether. (2) this freq-domain convolution idea can be extended to use the three-term Blackman window (and the "three-term Blackman-Harris" window). These windows have five non-zero freq-domain coefficients but they also have much lower sidelobes (reduced spectral leakage) than the Hamming window. See Ya', [-Rick-] |