1
$\begingroup$

I have a long-duration EMG signal (~4 hours long) with a sampling frequency of 1 kHz. If I want to filter the data with a low-pass filter in 10 Hz in MATLAB, should I filter the signal with moving window? I am using Butterworth (4th order) IIR filter.

$\endgroup$
  • 1
    $\begingroup$ What is the sample rate? $\endgroup$ – Daniel Kiracofe Jul 28 '17 at 23:23
  • $\begingroup$ If you use an IIR filter (rather than an FIR), what advantage do you expect to get by using a moving window as well? As you said, a moving window is just another type of filter. $\endgroup$ – alephzero Jul 29 '17 at 16:07
  • 1
    $\begingroup$ 1000 Hz @DanielKiracofe $\endgroup$ – Larry To Aug 10 '17 at 20:03
  • $\begingroup$ could you maybe comment on why you want to apply a moving window? Is it because of memory or CPU considerations? Or is is supposed to run "on-line" so you do not have the complete signal in one point in time? $\endgroup$ – rul30 Dec 10 '17 at 12:56
1
$\begingroup$

First, I'm assuming that by "moving window", you mean breaking the signal up into smaller chunks and filtering each chunk separately. In the signal processing word, "moving window" would often mean an FIR filter (e.g. fir1() in matlab), but because you explicitly said you are using butterworth filter, which is an IIR filter, I assume that is not what you are talking about. If I am wrong, please edit the question to clarify.

Now, 4 hours at 1000 S/s would occupy about 100 Mb of ram. That's big, but not outlandish. Assuming you have a 64 bit processor and a decent amount of RAM (2 GB or more), there is no reason to break this up into smaller chunks. I filter vectors of 100 MB in one single pass (i.e. without breaking them up) all the time. Any computer built within the past 3 or 4 years should be able to handle this just fine. 10 years ago the answer would have been different.

$\endgroup$
0
$\begingroup$

The short answer is you should not use a moving window because the moving window itself creates a low-pass-ish filtering effect.

But as @DanielKiracofe already stated you could slice the signal up into smaller segments and filter those. Of course you need to be careful that the your window size fits your low-pass filter.

However, in order to circumvent the problem of stitching the slices together I would use a short segment (duration: 10s) of the signal to test your code and and than run filtfilt on the whole signal to reduce phase-shifting.

$\endgroup$

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.