2

I'm working with some accelerometer data and it has been suggested that I do some windowing for isolating different events in the signal. Unlike most things, windowing is poorly documented in MATLAB and I was hoping for some simple examples (or suggested reading and links) of windowing being implemented. I was also wondering why window at all instead of just breaking the data into sections and analysing the individual frames. Thanks.

An example of a test or event is shown below:enter image description here

My initial data looked like this: Shown above is single spike expanded.

Also can some suggest how I would window the first plot using MATLAB.

enter image description here

Michael
  • 129
  • 1
  • 8

1 Answers1

1

Windowing is more in the realms of signal processing theory than programming, however it is very important when understanding the output of an FFT, so probably worth explaining in a little more detail.

Essentially, when you truncate a signal (for example process it in blocks), you are altering the frequency domain in a rather surprising way. You end up convolving (i.e. smearing) all frequency terms with a "window" function. If you do nothing other than truncate, then that function is sin()/sin(). What happens is that this spreads the frequency content of the original signal over the entire spectrum, and if there is a dominant component, then everything else gets buried by this. The shorter the blocks, the worse the effect is as the window gets fatter in the frequency domain.

Windowing with shaped window, such as Hamming, Hanning or Blackman, alters the frequency domain response, making the smearing more localised to the original signal. The resulting frequency domain is much clearer as a result.

To analyse a block of data, x, then what you should do is

transform=fft(x.*hanning(length(x)));

The result will be complex, which you can display with plot(20*log10(abs(transform)))

For a mathematical analysis see https://cnx.org/contents/4jyGq_c3@6/Spectrum-Analysis-Using-the-Di

If you want a practical hands-on experience of what windowing does, try https://cnx.org/contents/CJ3fYEow@2/Spectrum-Analyzer-MATLAB-Exerc

Dave
  • 460
  • 2
  • 7
  • Thank you for detailed response @Dave. Some of the signals I am working with consist of a number of short discrete events independent of each other. In this case, is it ok to just divide the signal into each single event and calculate the FFT of each event. – Michael Sep 15 '16 at 15:48
  • If the events are short, then you definitely need to window the data! A short sequence results in wide windows, with the worst possible smearing resulting from truncation alone. It is a simple thing to try different windows - just replace the "hamming" with something more appropriate. You do need to be a bit careful though, as the more powerful the window (the lower the smearing at frequencies more distant to the strong spectral component), then the wider the main component will be, which means resolution in the frequency domain drops. You don't get something for nothing! – Dave Sep 15 '16 at 15:56
  • The events are short but the signal goes completely to zero between the events. It was just the way we recorded the data. Instead of recording a signal for every event or test, we continuously recorded and allowed all transients to die before doing the next test. I will post an example in the original question. – Michael Sep 15 '16 at 17:57
  • Is it possible for me to window between 50 and 150 in the first example shown? This is the region of interest for each event. – Michael Sep 15 '16 at 18:19
  • Yes, you can window this event, but the real question is what you expect the result to mean. What you are looking at is a transient response, which isn't well described by an FFT. The FFT is designed to extract periodic components from a signal, but here the components are *not* periodic - they die away. You might want to consider something like a wavelet transform which represents frequency and time together. (High frequency events can be short lived, whilst low frequency events tend to be longer). – Dave Sep 21 '16 at 15:30