RelativeRootMeanSquareError - Maple Help
For the best experience, we recommend viewing online help using Google Chrome or Microsoft Edge.

SignalProcessing

 RootMeanSquareError
 calculate the root mean square error between two signals
 RelativeRootMeanSquareError
 calculate the relative root mean square error between two signals

 Calling Sequence RootMeanSquareError( X, Y ) RelativeRootMeanSquareError( X, Y )

Parameters

 X, Y - rtables or lists of real or complex data.

Description

 • The RootMeanSquareError command takes two rtables or lists of data with compatible dimensions, and returns the Root Mean Square Error (RMSE), which is the Root Mean Square (RMS) of the difference of $X$ and $Y$. When $X$ and $Y$ are Vectors with $n$ elements:

$\mathrm{RootMeanSquareError}\left(X,Y\right)=\sqrt{\frac{{\sum }_{i=1}^{n}{\left|{X}_{i}-{Y}_{i}\right|}^{2}}{n}}$

 • The RelativeRootMeanSquareError command takes two rtables or lists of data with compatible dimensions, and returns the Relative Root Mean Square Error (RRMSE), which is the Root Mean Square (RMS) of the difference of $X$ and $Y$, divided by the RMS of $Y$. When $X$ and $Y$ are Vectors with $n$ elements:

$\mathrm{RelativeRootMeanSquareError}\left(X,Y\right)=\mathrm{Typesetting}:-\mathrm{_Hold}\left(\left[\mathrm{%/}\left(\mathrm{sqrt}\left(\frac{\mathrm{Sum}\left({\mathrm{abs}\left({X}_{i}-{Y}_{i}\right)}^{2},i=1..n\right)}{n}\right),\mathrm{sqrt}\left(\frac{\mathrm{Sum}\left({\mathrm{abs}\left({Y}_{i}\right)}^{2},i=1..n\right)}{n}\right)\right)\right]\right)$

 • The advantage of using RRMSE over RMSE to quantify error is that the error is relative to the comparison container, which prevents relatively small errors from appearing large, and relatively large errors from appearing small.
 • The inputs are converted to Arrays of float[8] or complex[8] datatype, and an error will be thrown if this is not possible. For this reason, it is most efficient for the inputs to already be rtables having the appropriate datatypes.
 • The RelativeRootMeanSquareError and RootMeanSquareError commands are not thread safe.

Examples

 > $\mathrm{with}\left(\mathrm{SignalProcessing}\right):$

Example 1

 > $X≔{\mathrm{Vector}}_{\mathrm{row}}\left(\left[1,2,3\right]\right)$
 ${X}{≔}\left[\begin{array}{ccc}{1}& {2}& {3}\end{array}\right]$ (1)
 > $Y≔{\mathrm{Vector}}_{\mathrm{column}}\left(\left[4,5,6\right]\right)$
 ${Y}{≔}\left[\begin{array}{c}{4}\\ {5}\\ {6}\end{array}\right]$ (2)
 > $\mathrm{RootMeanSquareError}\left(X,Y\right)$
 ${3.00000000000000044}$ (3)

Example 2

 > $X≔⟨1.1,1.9,3.1⟩$
 ${X}{≔}\left[\begin{array}{c}{1.1}\\ {1.9}\\ {3.1}\end{array}\right]$ (4)
 > $Y≔\left[1,2,3\right]$
 ${Y}{≔}\left[{1}{,}{2}{,}{3}\right]$ (5)
 > $\mathrm{RelativeRootMeanSquareError}\left(X,Y\right)$
 ${0.0462910049886276140}$ (6)

Example 3

 • In this example, the RMSE suggests two Vectors are very close (in the absolute sense), but the RRMSE shows that to not be the case (in the relative sense):
 > $P≔⟨0.00003,0.00004⟩$
 ${P}{≔}\left[\begin{array}{c}{0.00003}\\ {0.00004}\end{array}\right]$ (7)
 > $Q≔⟨0.00001,0.00002⟩$
 ${Q}{≔}\left[\begin{array}{c}{0.00001}\\ {0.00002}\end{array}\right]$ (8)
 > $\mathrm{RootMeanSquareError}\left(P,Q\right)$
 ${0.0000199999999999999982}$ (9)
 > $\mathrm{RelativeRootMeanSquareError}\left(P,Q\right)$
 ${1.26491106406735154}$ (10)

Example 4

 • Here, the RMSE suggests two Vectors are not very close (in the absolute sense), but the RRMSE shows the Vectors are in fact pretty close (in the relative sense):
 > $U≔⟨503,604⟩$
 ${U}{≔}\left[\begin{array}{c}{503}\\ {604}\end{array}\right]$ (11)
 > $V≔⟨500,600⟩$
 ${V}{≔}\left[\begin{array}{c}{500}\\ {600}\end{array}\right]$ (12)
 > $\mathrm{RootMeanSquareError}\left(U,V\right)$
 ${3.53553390593273731}$ (13)
 > $\mathrm{RelativeRootMeanSquareError}\left(U,V\right)$
 ${0.00640184399664479788}$ (14)

Example 5

 • Complex data is also supported:
 > $A≔\mathrm{Vector}\left(\left[1,2-I\right],'\mathrm{datatype}'='{\mathrm{complex}}_{8}'\right)$
 ${A}{≔}\left[\begin{array}{c}{1.}{+}{0.}{}{I}\\ {2.}{-}{I}\end{array}\right]$ (15)
 > $B≔\mathrm{Vector}\left(\left[3,4+I\right],'\mathrm{datatype}'='{\mathrm{complex}}_{8}'\right)$
 ${B}{≔}\left[\begin{array}{c}{3.}{+}{0.}{}{I}\\ {4.}{+}{I}\end{array}\right]$ (16)
 > $\mathrm{RootMeanSquareError}\left(A,B\right)$
 ${2.44948974278317788}$ (17)
 > $P≔\mathrm{Vector}\left(\left[5,6\right],'\mathrm{datatype}'='{\mathrm{float}}_{8}'\right)$
 ${P}{≔}\left[\begin{array}{c}{5.}\\ {6.}\end{array}\right]$ (18)
 > $Q≔\mathrm{Vector}\left(\left[10-3I,7\right],'\mathrm{datatype}'='{\mathrm{complex}}_{8}'\right)$
 ${Q}{≔}\left[\begin{array}{c}{10.}{-}{3.}{}{I}\\ {7.}{+}{0.}{}{I}\end{array}\right]$ (19)
 > $\mathrm{RelativeRootMeanSquareError}\left(P,Q\right)$
 ${0.470658036520967271}$ (20)

Compatibility

 • The SignalProcessing[RootMeanSquareError] and SignalProcessing[RelativeRootMeanSquareError] commands were introduced in Maple 2021.
 • For more information on Maple 2021 changes, see Updates in Maple 2021.
 • The SignalProcessing[RootMeanSquareError] and SignalProcessing[RelativeRootMeanSquareError] commands were updated in Maple 2022.