Smoothing 1D not equidistant curve by convolution
The filtering is done with a triangle filter by convolution of the resampled non equidistant curve. Also with automatic generation of suitable filter width.
In order to get a full curve filtering, the curve is linear extrapolated on both sides and not zero padded.
1 Manual
Invoke the function with: [ys,wout*,xse*,yse*]=smooth1DconvNE(xy,w*)
*) optional arguments
Valid is also e.g.: ys =smooth1DconvNE(xy)
1.1 Input:
The first argument xy is the curve to be smoothed.
The first column contains the x-values and the second column contains the corresponding y-values. The input xy may be also crated as two rows. The minimum are 3 sample pairs.
The 2nd argument, called w (width of filter), is optional.
w is a scalar floating number in x-units. 0 ≤ w < 0.9 * length of curve.
For w=0 no filtering, but a resampled curve xse, yse is returned.
Two modes are possible:
1.) w omitted: Filter width is determined by FFT.
2.) w is set as a floating number in x-units and used as filter.
1.2 Output:
ys: smoothed y as vertical vector. The x-values remain unchanged. Vertical vector.
wout: filter width used
xse: resampled equidistant x-values of the smoothed curve. Vertical vector.
yse: resampled equidistant y-values of the smoothed curve. Vertical vector.
In case of a bad input, all outputs are set to zero.
1.3 Remark:
The border values of the smoothed output ys are approximations. In order to calculate those values, the input y is extended by extrapolation of the smoothed input. The approximated border output is one half of the filter width.
引用格式
Peter Seibold (2024). Smoothing 1D not equidistant curve by convolution (https://www.mathworks.com/matlabcentral/fileexchange/132528-smoothing-1d-not-equidistant-curve-by-convolution), MATLAB Central File Exchange. 检索时间: .
MATLAB 版本兼容性
创建方式
R2016a
兼容任何版本
平台兼容性
Windows macOS Linux标签
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!