Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

difference between phase and angle command in matlab

Tags:

matlab

What is the difference between phase and angle commands in Matlab? THey seem to giv different results for the same input

Ref:

Matlab help for phase

PHASE  Computes the phase of a complex vector

    PHI=phase(G)

    G is a complex-valued row vector and PHI is returned as its
    phase (in radians), with an effort made to keep it continuous
    over the pi-borders.

Matlab help for angle

ANGLE  Phase angle.
    ANGLE(H) returns the phase angles, in radians, of a matrix with
    complex elements.  

    Class support for input X:
       float: double, single

Also, can you please explain in simple terms what exactly is the use of the uwrap command?

like image 765
user13267 Avatar asked Dec 07 '25 14:12

user13267


1 Answers

At first, ANGLE command is from MATLAB core, PHASE from system identification toolbox.

ANGLE command always give result in range [-pi, pi].

PHASE command is more complex. If you have two adjacent points in input vector with phase near pi, for example

X=[-1+0.1i -1-0.1i]

phase(X) command will give answer greater than pi for the second value (difference between phases values should be less than pi).

At this time angle(X) command will give value near -pi for the second argument (wrap values into range [-pi, pi]). E.g.

phase(X(2)) = angle(X(2)) + 2*pi
like image 79
Danil Asotsky Avatar answered Dec 10 '25 17:12

Danil Asotsky