I have the following time series current measurement recordings at 5,000 samples per seconds for 10 minutes:


I am trying to find a way to extract the recordings of the periodic intervals that are higher in current consumption as shown in the picture below:


These periodic portions come every 120ish seconds. However, their interval duration is not constant, i.e. you can notice how the width changes. So I want to get the starting and end points to be able to extract that portion and do some analysis on it.

Here are three intervals extracted manually and plotted:


I have been trying various things attempting to extract this portion but wasn't successful. Maybe I am following the wrong methods overall. I am doing this in MATLAB and I am not a DSP expert.

The latest thing I have tried to do is a simple moving average with a lag of 5,000, i.e. the sampling rate, using the MATLAB function tsmovave(data, 's', 5000) and I got the following:


However, the signal doesn't look clean enough to apply simple thresholds on it and pull out what I need.

I also tried to increase the lag time to 120 seconds (i.e. the period interval) and then attempted to extract minimums and maximums using the MATLAB function findpeaks(), but that didn't work because there are a lot of local minimums and maximums in the data. So I tried to resample at a lower rate but that still didn't work.

Someone suggested that I should use matched filter and provide a manually extracted interval to the filter. Another method I came across in my research is implementing some sort of step-finding algorithm.

From your experience, what's the best way to go about doing this DSP. It seems like a simple problem but I spent a lot of time trying to solve it and couldn't. I am not an expert in DSP. I appreciate any feedback and direction.

  • $\begingroup$ The question should perhaps be migrated to dsp.stackexchange.com $\endgroup$
    – Gala
    Commented Jul 1, 2013 at 5:34

1 Answer 1


Trying a moving average filter was a good first attempt, and it's probably what I would have tried first. It looks to me like you could do some simple thresholding and either set the threshold relatively high and "fill in" the gaps created when the signal gets too low, or set the threshold low ignore it when the signal only goes over the threshold briefly. You may want to look up binary image operations for inspiration.

Instead of the moving average filter, you could try are:

  • Gaussian filter
  • Median Filter (I think you will have good luck with this)
  • IIR low pass filter

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.