# Doubts about digital signal processing methodology

Disclaimer: I'm a beginner at all of this.

I am working with vibration data from accelerometers recorded at a sampling rate of 1600 Hz and the vibrations are induced by a source within the range of 20-40 Hz. I snip out about 60-80 seconds of data and use it for analysis. I have the following work flow to perform some basic analysis on this vibration data, where I run the data through a series of digital band passes (all 5Hz - 500Hz) and integrate it:

I am able to generate plots that look this this:

My questions are:

1. The strange peaks in the overview at the extreme ends : I understand from a bit of reading around, that this is due to passing my snipped signal through a digital band pass filter without padding it on both sides. Another method that I have read which could solve this is - subtract the mean value of the input signal, pass it through the DBP and then add the average back to the output from the filter. Is this the correct solution? Can someone explain why this happens, from a mathematical PoV please?

2. When I snip my main signal into chunks of 60-80s, am I already kind of performing a window function? If not, is it always essential to use a window function before I perform an FFT? Because, the smaller chunks that I snip out are already fully relevant for performing an FFT and I don't see how a window function would be relevant in this case.

Thank You!

The reason you get the artifacts at the ends of your data segments is because the filter "sees" a jump there. Depending on how the filter is implemented there is either implied zero-padding at the ends and the filter is responding to the jump from zero to the average value, or the filter uses the FFT to speed things up and "sees" the end point as contiguous with the beginning point.

Removing the DC component before filtering is appropriate. Usually for this kind of analysis you want to remove not just DC, but any slope.

Because you are bandpass filtering, adding the DC component back in is not appropriate -- this is because a bandpass filter does not pass DC. What you want is the signal that you would have gotten from bandpass filtering first, then snipping. That signal would have no DC component.

A method that you haven't mentioned, but could work nicely, is to choose a longer snippet, filter it, then trim off the ends to the length of the settling time of the filter.

On windowing:

Yes, just hacking a chunk of data out of the middle of an infinitely long signal is windowing. For the purposes of taking an FFT, it's really bad windowing. Search on "spectral leakage". Basically, the sharp edges of the rectangular window cause the resulting FFT to be smeared out. Properly windowing (and the proper window depends on your data) significantly reduces the smearing.

In fact, if you're bandpass filtering then taking the FFT, you're probably wasting effort. Detrend the data (remove the DC and slope), window, and take your FFT. If there's frequencies you want to ignore, remove them from the FFT (properly -- just zeroing out the unwanted frequencies without transitioning into the stop band is as bad in its way as not windowing your input data properly).

• Thank you Tim, for your swift answer. Just to make it clear again, my problem with the 'jumps' at the end of my data are the ones that show as strange spikes in the time-domain representation. And if I want to get rid of these 'jumps' I must either pad the signal with zeroes ( btw, is that supposed to be on both sides or just one side?) OR I must remove the DC component before filtering. Sep 27, 2022 at 10:42
• Also, as a note, I would like to add the DC component back because I use that output signal of DBP for integration into speed and displacement as you can see. Is this recommended? Or is it better if I use the raw signal to perform the integration, and then use a DBP on the already 'integrated' signal ? Sep 27, 2022 at 10:44
• Just one last follow-up question about windowing: Once I do snip out the relevant portion of my data (do a rect window), can I further apply another window function that is appropriate for my type of data? Is that mathematically correct? Sep 27, 2022 at 10:54
• If you use an appropriate window that is zero everywhere your rectangular window is, yes. It generally means you want to start with a longer snippet of data (with length depending on what window you're using, and what you're trying to squeeze out of your data). Sep 27, 2022 at 15:05