Smoothing 1D not equidistant curve by convolution

Version 1.1 (1.73 MB) by Peter Seibold
The filtering is done with a triangle filter by convolution of the resampled non equidistant curve. Also with automatic filter generation.
23 Downloads
Updated 11 Jul 2024

View License

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.

Cite As

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. Retrieved .

MATLAB Release Compatibility
Created with R2016a
Compatible with any release
Platform Compatibility
Windows macOS Linux

Community Treasure Hunt

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

Start Hunting!
Version Published Release Notes
1.1

Identical x values are removed during process and added later on in the result.

1.0.0