Segmented smooth function

版本 1.0.0.0 (9.4 KB) 作者: Tom O'Haver
Multiple segment variant of fastsmooth.m
191.0 次下载
更新时间 2016/11/19

查看许可证

SegmentedSmooth(y,w,type,ends) divides y into a number of equal-length
segments defined by the length of the vector 'smoothwidths', then
smooths each segment with smooth of type 'type' and width defined by
the elements of vector 'smoothwidths'. Same syntax as fastsmooth.
Version 1, November 2016.
The argument "type" determines the smooth type:
If type=1, rectangular (sliding-average or boxcar)
If type=2, triangular (2 passes of sliding-average)
If type=3, pseudo-Gaussian (3 passes of sliding-average)
If type=4, pseudo-Gaussian (4 passes of same sliding-average)
If type=5, multiple-width (4 passes of different sliding-averages)
The argument "ends" controls how the "ends" of the signal
(the first w/2 points and the last w/2 points) are handled.
If ends=0, the ends are zero. (In this mode the elapsed
time is the fastest and is independent of the smooth width).
If ends=1, the ends are smoothed with progressively
smaller smooths the closer to the end. (In this mode the
elapsed time increases with increasing smooth widths).
SegmentedSmooth(Y,w,type) smooths with ends=0.
SegmentedSmooth(Y,w) smooths with type=1 and ends=0.

Examples: 3-segment smooth of random white noise, smooth widths of
2,20, and 200.
x=1:10000;y=randn(size(x));
plot(x,SegmentedSmooth(y,[2 20 200],3,0))

20-segment smooth, odd smooth widths from 1 to 41:
plot(x,SegmentedSmooth(y,[1:2:41],3,0))

引用格式

Tom O'Haver (2026). Segmented smooth function (https://ww2.mathworks.cn/matlabcentral/fileexchange/60300-segmented-smooth-function), MATLAB Central File Exchange. 检索时间: .

MATLAB 版本兼容性
创建方式 R2009a
兼容任何版本
平台兼容性
Windows macOS Linux
版本 已发布 发行说明
1.0.0.0