# 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"? – Engineer Apr 11 at 13:20
• Take the FFT of my data and after that to smooth the spectrum using a hanning window. – 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
w=hann(N);

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. – jithin Apr 11 at 12:45