Compute arbitrary function in sliding window

版本 1.0.0.0 (3.4 KB) 作者: David J. Mack
This function quickly computes an arbitrary function on a sliding window.
166.0 次下载
更新时间 2016/9/1

查看许可证

This function can compute any function which operates on column-oriented data over a sliding centered window on column-vector data. It is vectorized and thus trades memory-usage for speed.
For small window sizes this outperforms functions like SMOOTH. But it is not just a fast moving average. You can specify any function handle that operates on column-oriented data and produces a scalar output, e.g. median, std, prctile (with a scalar 'p'), range, min, sum. But you could also create your own function. For example the (quite obscure) function handle
@(X) all(bsxfun(@gt,X(ceil(size(X,1)/2),:),X(1:floor(size(X,1)/2),:)),1) &
all(bsxfun(@ge,X(ceil(size(X,1)/2),:),X(ceil(size(X,1)/2)+1:end,:)),1)
will return a logical array indicating local maxima over a given window size reporting only the first maximum at plateaus.

引用格式

David J. Mack (2024). Compute arbitrary function in sliding window (https://www.mathworks.com/matlabcentral/fileexchange/58949-compute-arbitrary-function-in-sliding-window), MATLAB Central File Exchange. 检索时间: .

MATLAB 版本兼容性
创建方式 R2010a
兼容任何版本
平台兼容性
Windows macOS Linux
类别
Help CenterMATLAB Answers 中查找有关 ECG / EKG 的更多信息

Community Treasure Hunt

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

Start Hunting!
版本 已发布 发行说明
1.0.0.0

Updated description.