Matrix::PhaseSpectrum Method

Overload List

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

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

The phase angles (spectrum) of object elements.

#NameTypeDescription
1VecTMtxVec *
Remarks:

Calculates the phase angles (spectrum) of all Vec object elements. Phase values are returned in radians and are in the range [-PI,PI]. Size and Matrix::Complex properties of the calling object are set implicitly to match Vec object. The phase angles are calculated from the following equation:

Phase[k]=arctan⁡ℑ(Vec[k])ℜ(Vec[k])\text{Phase}[k] = \arctan \frac{\Im (\text{Vec}[k])}{\Re (\text{Vec}[k])}
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.PhaseSpectrum(a); // b = [arctan2(1,2), arctan2(3,-4)];
}
See Also: Matrix::PowerSpectrum, Matrix::ArcTan2
Declared in Dew::Math::Matrix · Dew.Math/MtxExpr.h · Cross-compiler

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

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

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

Store the results in calling object elements [Index]..[Index+Len-1]. An exception is raised 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.PhaseSpectrum(a); // b = [arctan2(1,2), arctan2(3,-4)];
}
Declared in Dew::Math::Matrix · Dew.Math/MtxExpr.h · Cross-compiler