Matrix::PowerSpectrum Method

Overload List

#SignatureDescription
1TMtxVec *PowerSpectrum(TMtxVec *Vec) const;The power spectrum from object complex values.
2TMtxVec *PowerSpectrum(TMtxVec *Vec, int VecIndex, int Index, int Len) const;Calculates the power spectrum from the Vec complex elements [VecIndex]..[VecIndex+Len-1].

Overload 1: TMtxVec *PowerSpectrum(TMtxVec *Vec) const;

The power spectrum from object complex values.

#NameTypeDescription
1VecTMtxVec *
Remarks:

Calculates the power spectrum from the Vec object complex values and stores the results (power spectrum) in the real calling object. Size and Matrix::Complex properties of the calling object are set implicitly to match Vec object. The spectrum elements are squares of the magnitudes of the complex input elements:

Examples
#include "MtxExpr.h"

using namespace Dew;
using namespace Dew::Math;

void Example()
{
    Matrix a, b;

    a.SetIt(1, 2, true, DewArray<double>{1, 2, 3, -4}); // a = [1 + 2i, 3 - 4i]
    b.PowerSpectrum(a); // b = [1*1 + 2*2, 3*3+(-4)*(-4)]
}
See Also: Matrix::PhaseSpectrum
Declared in Dew::Math::Matrix · Dew.Math/MtxExpr.h · Cross-compiler

Overload 2: TMtxVec *PowerSpectrum(TMtxVec *Vec, int VecIndex, int Index, int Len) const;

Calculates the power spectrum from the Vec complex elements [VecIndex]..[VecIndex+Len-1].

#NameTypeDescription
1VecTMtxVec *
2VecIndexint
3Indexint
4Lenint
Remarks:

Store the results in calling object real elements [Index]..[Index+Len-1]. An exception is raised if calling object Matrix::Complex property is true or if array borders are overrun/underrun.

Examples
#include "MtxExpr.h"
#include "Units.Math387.h"

using namespace Dew;
using namespace Dew::Math;
using namespace Dew::Math::Units::Math387;

void Example()
{
    Matrix a, b;

    a = {{Cplx(1, 2), Cplx(3, -4)}}; // a = [1 + 2i, 3 - 4i]
    b.PowerSpectrum(a); // b = [1*1 + 2*2, 3*3+(-4)*(-4)]
}
Declared in Dew::Math::Matrix · Dew.Math/MtxExpr.h · Cross-compiler