Description Usage Arguments Value Note Author(s)
Given a set of (x,y) pairs with x in non-decreasing order, apply a
function to each maximal set of consecutive pairs where the range
of x values is at most a fixed value w, the window size. For
example, if x is time, y is temperature, w is 30 and the function
is mean
, calculate the mean temperature over a sliding
window of width 30 seconds.
1 | windowApply(x, y, w, f)
|
x |
- vector of values in non-decreasing order |
y |
- vector of arbitrary values, with
|
w |
- width of sliding window in same units as |
f |
- function of one or two variables to apply to each
sliding window of values. |
result of applying f
to a sliding window of y
values; this has the same length as x
and y
. The
i
th element is obtained by applying f
to
y[i:j]
where j
is the largest index such that j
<= length(x)
and x[j]-x[i] < w
The number of elements of y used to compute each element in the result will not in general be constant. It will be constant if the values of x are equally spaced, except that the tail end of the result will be computed with fewer elements.
John Brzustowski jbrzusto@REMOVE_THIS_PART_fastmail.fm
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.