Calculates the moving RMS of a series.
MOVRMS(series, N, rampflag, "naflag", "edgeflag")
series |
- |
A series or array, the input series |
||||||||||||
N |
- |
An integer, the number of points to compute the variance as the series is processed. |
||||||||||||
rampflag |
- |
Optional. An integer, endpoint averaging flag.
|
||||||||||||
"naflag" |
- |
Optional. A string, the NA handling method.
|
||||||||||||
"edgeflag" |
- |
Optional. A string, the edge processing flag.
|
A series or table.
W1: {4, 3, 2, 1, 2, 3, 4}
W2: movrms(w1, 3)
W2 == {4, 3.5355, 3.1091, 2.1602, 1.7321, 2.1602, 3.1091, 3.5355, 4}
W2 computes the RMS of each overlapping moving segment of length 3 but the segment length adjusts from 1 to 3 at the start edge and from 3 to 1 at the end edge. The segment divisor adjusts accordingly.
W1: {4, 3, 2, 1, 2, 3, 4}
W3: movrms(w1, 3, 0)
W3 == {2.3094, 2.8868, 3.1091, 2.1602, 1.7321, 2.1602, 3.1091, 2.8868, 2.3094}
Same as above where the segment length adjusts from 1 to 3 at the start edge and from 3 to 1 at the end edge but N is fixed at 3 and the segment divisor remains fixed at 3.
W1: {4, 3, 2, nan, 2, 3, 4}
W2: movrms(w1, 3)
W3: movrms(w1, 3, "includenan")
W2 == {4, 3.5355, 3.1091, 2.1602, 1.7321, 2.1602, 3.1091, 3.5355, 4}
W3 == {4, 3.5355, 3.1091, nan, nan, nan, 3.1091, 3.5355, 4}
W2 ignores all NA values by removing the NaN from the segment and adjusting the segment size down.
W3 includes NaNs and produces an NaN if the segment includes an NaN.
W1: {4, 3, 2, nan, 2, 3, 4}
W2: movrms(w1, 3, 0)
W3: movrms(w1, 3, 0, "includenan")
W2 == {2.3094, 2.8868, 3.1091, 2.5495, 2, 2.5495, 3.1091, 2.8868, 2.3094}
W3 == {2.3094, 2.8868, 3.1091, nan, nan, nan, 3.1091, 2.8868, 2.3094}
Same as above except the segment divisor remains fixed at 3.
W1: {4, 3, 2, 1, 2, 3, 4}
W2: movrms(w1, 3, "center")
W3: movrms(w1, 3, 0, "center")
W2 == {3.5355, 3.1091, 2.1602, 1.7321, 2.1602, 3.1091, 3.5355}
W3 == {2.8868, 3.1091, 2.1602, 1.7321, 2.1602, 3.1091, 2.8868}
W2 and W3 compute a 3 point centered moving RMS where the result at point N is the average of points N-1, N and N+1.
For W2, the segment length and segment divisor adjust from 1 to 3 at the start edge and from 3 to 1 at the end edge.
For W3, the segment length also adjusts from 1 to 3 at the start edge and from 3 to 1 at the end edge but the segment divisor remains fixed at 3.
W1: {4, 3, 2, 1, 2, 3, 4}
W2: movrms(w1, 3, "discard")
W3: movrms(w1, 3, 0, "discard")
W2 == {3.1091, 2.1602, 1.7321, 2.1602, 3.1091}
W3 == {3.1091, 2.1602, 1.7321, 2.1602, 3.1091}
W2 and W3 compute a 3 point moving RMS for all overlapping segments that contain exactly 3 samples. Shorter segments at the start and end edges are discarded. The rampflag parameter has no effect.
W1: {4, 3, 2, 1, 2, 3, 4}
W2: movrms(w1, 3, "shrink")
W3: movrms(w1, 3, 0, "shrink")
W2 == {4, 3.5355, 3.1091, 2.1602, 1.7321, 2.1602, 3.1091, 3.5355, 4}
W3 == {4, 3.5355, 3.1091, 2.1602, 1.7321, 2.1602, 3.1091, 3.5355, 4}
Same as the first example, where the RMS of each overlapping moving segment of length 3 is computed but the segment length and segment divisor adjust from 1 to 3 at the start edge and from 3 to 1 at the end edge. The rampflag is essentially forced to 1.
W1: {4, 3, 2, 1, 2, 3, 4}
W2: movrms(W1, length(W1))
W2[length(w1)] == rms(w1) == 2.9032
MOVRMS computes the moving discrete root mean square value. For each section of length N, the RMS value is defined as:
For speed, this routine uses the built-in function MOVAVG.
See LINRMS to compute a phase-less moving RMS.