Movrms
Description
The function returns a vector to calculate the root mean square(rms) of adjacent ranges [i-nb, i+nf], for a point i
The root mean square of adjacent ranges at point i is given by
/math-6f01f21be5d9da71579da00a26631d67.png)
where
is the backward offset and
is the forward offset
Syntax
vector Movrms(vector vx, int back[, int forward])
Parameters
vx
- Input data vector used to calculate adjacent rms.
back
- Input integer for the offset backward with respect to current row number.
forward
- Input integer for the offset forward with respect to current row number. If forward is omitted, it will be set to be equal to back internally
Return
Return the adjacent RMS vector
Notes: The boundary will be treated with the way below
![y_i=\left\{\begin{matrix} RMS([x_0, x_{i+forward}]), & \textup{if} \; i <= back -1;\\ RMS([x_{i-back}, x_{n-1}]), & \textup{if} \; i > n-1-forward. \end{matrix}\right. y_i=\left\{\begin{matrix} RMS([x_0, x_{i+forward}]), & \textup{if} \; i <= back -1;\\ RMS([x_{i-back}, x_{n-1}]), & \textup{if} \; i > n-1-forward. \end{matrix}\right.](/labtalk/ja/images/Movrms_(function)/math-b3936c93b005a7ae9d757f4c11046ea1.png)
Example
//Col(B) will be filled with rms at each point for data within the window [i-2, i+2] //Col(C) will be filled with rms at each point for data within the window [i, i+2] for(ii=1;ii<=30;ii++) col(A)[ii] = ii; col(B)=movrms(col(1),2); col(C)=movrms(col(1),0, 2);