DADiSP Worksheet Functions > Function Categories > Fourier Transforms and Signal Processing > AVGFILT
Filters a series using the average of the N neighboring points.
AVGFILT(series, N, gval, lval)
series |
- |
An input series or table. |
N |
- |
Optional. An integer, the number of neighbors to average. For point i, average points i-N through i+N exclusive of point i. Defaults to 1, i.e. for point i, average points i-1 and i+1 |
gval |
- |
Optional. A real, the "greater than" threshold at which to replace a point. Point i is replaced if: |
lval |
- |
Optional. A real, the "less than" threshold at which to replace a point. Point i is replaced if: |
A series.
W1: gnorm(100,.01)
W2: avgfilt(W1)
replaces each point of W1 with the average of the previous and next point if it exceeds the average.
W3: avgfilt(W1, 2)
replaces each point of W1 with the average of the two previous and two next points if it exceeds the average.
W3: avgfilt(W1, 1, 1.2)
replaces each point of W1 with the average of the previous and next point if it exceeds the average by 20%.
W4: avgfilt(W1, 1, 1.2, 1.3)
replaces each point of W1 with the average of the previous and next point if it exceeds the average by 20% or is less than the average by 30%.
W5: avgfilt(W1, 1, 0, 0)
replaces each point of W1 with the average of the previous and next point unconditionally.
W6: -avgfilt(-W1, 1, 1.2)
replaces each point of W1 with the average of the previous and next point if it is less than the average by 20%.
AVGFILT uses the convolution function to calculate the neighbor averages. For N == 1, the kernel is simply: {1, 0, 1} / 2
See BLOCKAVG to compute a simple N point non-overlapping moving average.