MATLAB Answers

0

Sliding window centered at a given point

Asked by Laura petrescu on 24 Aug 2019 at 10:41
Latest activity Commented on by Image Analyst
on 24 Aug 2019 at 22:05
Hi! I have a signal and I need to create a sliding window of known length (let's say x) but it needs to be centered at a given point (y). Can anyone help me? Thanks!

  1 Comment

Adam Danz
on 24 Aug 2019 at 11:09

Sign in to comment.

1 Answer

Answer by Image Analyst
on 24 Aug 2019 at 13:32
Edited by Image Analyst
on 24 Aug 2019 at 13:34

What are you doing with signal values inside the sliding window? Taking the mean, std, or something custom? If it's some operation/function of your own invention, you can use nlfilter(). Otherwise maybe the family of mov***() might work, for example movmean(), etc. Or there's a variety of built-in functions, like sgolayfilt(), (which fits data in the window to a polynomial), etc.

  2 Comments

I have to extract some time and frequency features, including std, mean, etc
Image Analyst
on 24 Aug 2019 at 22:05
Try movmean(), movstd(), movvar(), movmedian(), stdfilt(), and nlfilt().
For frequency info, try fft(), spectrogram(), periodogram(), and pwelch().

Sign in to comment.