2.2.3.19.21 vectorbase::GetPhase

Description

Get the phase angle of the complex vector.

Syntax

int GetPhase( vector & vPhase )

Parameters

vPhase
[output] vector containing the phase angle of this Complex vector

Return

Returns 0 on success or -1 on failure.

Examples

EX1

void vectorbase_GetPhase_ex1()
{
    vector<complex> vecC = {1+2i, 3+4i, 5+6i, 7+8i};
    vector vecPh;
    vecC.GetPhase(vecPh);
    for (int ii = 0; ii < vecPh.GetSize(); ii++)
    	printf("%.2f ",vecPh[ii]);
    // Result:
    //        vecPh = {1.11, 0.93, 0.88, 0.85};
}

Remark

Get the phase angle of the complex vector in radians. Causes a runtime error if the underlying base type of the vector is not complex data type.

See Also

vectorbase::GetReal, vectorbase::GetImaginary, vectorbase::GetAmplitude, vectorbase::Conjugate, vectorbase::MakeComplex

Header to Include

origin.h