averagesmooth(data,​smoothwidth)

averagesmooth.m smooths 1D data sets by averaging over neighboring data points.

You are now following this Submission

averagesmooth.m accepts a row vector set(s) of data and how many neighbors (in one direction) you want to average each data point over. It returns the smoothed data set(s).
Inputs:
data -- any linear data set (it can have multiple sets, i.e. 2161x6 will smooth 6 sets of 2161 points)
smoothwidth -- is a natural number, with 0 meaning no smoothing, 1 meaning nearest neighbors are included in the average (3 pts), 2 meaning nearest and next-nearest are included (5 pts), etc..

averagesmooth.m pads the data set to repeat the endpoints. For example, with a smoothwidth of 3, the first point's value is:
(x1 + x1 + x1 + x1 + x2 +x3 +x4) / 7 i.e.: (3 points of padding using point 1 + point 1 + points 2, 3 and 4) / 7

Cite As

Jason Moscatello (2026). averagesmooth(data,smoothwidth) (https://in.mathworks.com/matlabcentral/fileexchange/63662-averagesmooth-data-smoothwidth), MATLAB Central File Exchange. Retrieved .

Categories

Find more on Curve Fitting Toolbox in Help Center and MATLAB Answers

General Information

MATLAB Release Compatibility

  • Compatible with any release

Platform Compatibility

  • Windows
  • macOS
  • Linux
Version Published Release Notes Action
1.1.0.0

Specified it accepts row vectors.

1.0.0.0