Smooth signal with Hanning

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!

• What do you mean by "smooth it's spectrum"? Apr 11 '20 at 13:20
• Take the FFT of my data and after that to smooth the spectrum using a hanning window. Apr 11 '20 at 13:29
• I think you apply the Hann window ("Hanning" is an old misnomer conflating "Hann" with "Hamming", no one with the name "Hanning") to the time-domain data for it to smooth the frequency-domain data. Sep 4 '21 at 2:31

You can generate Hann window of size $$N$$ and use it to window your signal $$x$$ using the MATLAB command
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. • If your signal size is $N$, generate hann window with size $N$. Just change the argument of hann command. Apr 11 '20 at 12:45