Overload List
| # | Signature | Description |
|---|---|---|
| 1 | double RMS() const; | Root mean square (RMS). |
| 2 | double RMS(int Index, int Len) const; | Calculate the RMS for calling object elements [Index]..[Index+Len-1] in-place. |
Overload 1: double RMS() const;
Root mean square (RMS).
Remarks:
Calculate the root mean square value for all calling object elements in-place. The root mean square (RMS) is defined by the equation:
Examples
#include "MtxExpr.h"
#include "Units.Math387.h"
using namespace Dew;
using namespace Dew::Math;
using namespace Dew::Math::Units::Math387;
void Example()
{
Vector a;
a.SetIt(DewArray<double>{ 1.0, 2.0, 3.0, 4.0 });
double result = a.RMS();
if (Abs(result - 2.73861278752583) > 1e-10)
throw tException(DewString("Vector.RMS: expected 2.73861278752583, got ") + SampleToStr(result));
}
#include "MtxExpr.h"
using namespace Dew;
using namespace Dew::Math;
void Example()
{
Vector a;
double c;
a.SetIt(false, DewArray<double>{1, 2, 3, 4});
c = a.RMS();
}
See Also: Vector::StdDev
Declared in Dew::Math::Vector · Dew.Math/MtxExpr.h · Cross-compiler
Overload 2: double RMS(int Index, int Len) const;
Calculate the RMS for calling object elements [Index]..[Index+Len-1] in-place.
| # | Name | Type | Description |
|---|---|---|---|
| 1 | Index | int | |
| 2 | Len | int |
Remarks:
An exception is raised if array borders are overrun.
Examples
#include "MtxExpr.h"
using namespace Dew;
using namespace Dew::Math;
void Example()
{
Vector a;
double c;
a = {1, 2, 3, 4};
c = a.RMS();
}
Declared in Dew::Math::Vector · Dew.Math/MtxExpr.h · Cross-compiler