Filter with variable span

2 views (last 30 days)
Johannes
Johannes on 29 May 2018
Answered: Johannes on 29 May 2018
Hello everybody,
I am in need of a filter with a variable span as my data points (x-values) have non-uniform spacing. I would like to use a moving average filter and/or Savitzky Golay Filter. However, the problem is that the spacing of my x-values is not uniform but decreasing (at least it is monotonously decreasing, but their is no systematic trend). When I use a simple MA or SG filter, I do have the problem that the data in the regions of low point density (large spacing, in the end) is smoothed way too much compared to the data in the beginning (high point density). Thus, I would need a filter function which automatically adjusts to that (diff(x) so to say). A least for the MA filter, I could think of a self-made solution using simple loops. But I guess that's very inefficient and I might not be the first one to seek for such a solution.
Any help is therefore much appreciated.
Thank you very much, Johannes

Answers (1)

Johannes
Johannes on 29 May 2018
Hi Anton, thank you for your answer. I also thought about the same thing. The grid would then have to be as fine as the highest point density I have in my data. However, I was afraid that this might mess with the intrinsic white noise in my data. Or wouldn't you expect this to be a problem? Thanks!

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!