smean (sliding mean integral)

Sliding mean integral filter. Smooths the curve by moving a sliding window over the curve and calculating the mean value. This is done by calculating the area of the sliding window regardless of whether or not there are points at the window boundary, and divides this area by the window size.

Syntax

smean(x_in, y_in, winsize, boundarywinsize, numrep)

Argument

x_in
The x vector of the curve data.
y_in
The y vector of the curve data.
winsize
The area of the sliding window.
boundarywinsize
Allows you to specify how the beginning and end of curves should be handled. Acceptable values for this argument include:
1
The window size expands with each point until it reaches the given size when the point is the half distance from the beginning or the end (default).
Figure 1. smean(c1.x,c1.y,0.025,1,1)


2
Starts with the half window size.
Figure 2. smean(c1.x,c1.y,0.025,2,1)


3
Padding: Point reflection of the values inside of the half window size, at the first point at the beginning of the curve and at the last point at the end of the curve.
Figure 3. smean(c1.x,c1.y,0.025,3,1)


numrep
Allows you to specify how many times the algorithm repeats. This must be an integer and the default value is 1.

Example

Figure 4.