I have an acceleration record and i want to smooth it's spectrum by using a hanning window with Bandwidth=0.5 Hz.

How could i do that?

Example in python/matlab will be appreciated!

  • $\begingroup$ What do you mean by "smooth it's spectrum"? $\endgroup$ – Engineer Apr 11 at 13:20
  • $\begingroup$ Take the FFT of my data and after that to smooth the spectrum using a hanning window. $\endgroup$ – John_Seism Apr 11 at 13:29

You can generate Hann window of size $N$ and use it to window your signal $x$ using the MATLAB command

x_windowed = x.*w;

Since you specified BW of 0.5Hz, you need normalize it with your sampling rate $F_s$. That is $w_s = \pi 0.5/F_s$. You need to choose $N$ such that your main lobe width of the Hann window falls at $w_s$. It is not an easy problem and you may have to do trial and error initially. You can use freqz(w) command in MATLAB to see the frequency plot of Hann window. You can hover an see at what normalized frequency your main lobe width is.

enter image description here

| improve this answer | |
  • $\begingroup$ My signal has different size compared to the Hann window. So how can i do the multiplication without causing error? $\endgroup$ – John_Seism Apr 11 at 12:37
  • 1
    $\begingroup$ If your signal size is $N$, generate hann window with size $N$. Just change the argument of hann command. $\endgroup$ – jithin Apr 11 at 12:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.