I have the measurements of an amplitude modulated signal. I analysed with the fft() matlab function. After I calculate everything by "the book", I have only one problem. The phase of the modulated signal is not ok. Only if I subtract pi/2
form the calculated phase, I get the correct value. The modulated signal is the sixth component:
X[6]= -8.2257e+001 -1.6158e+002i
phase(x[6])=atan(-8.2257e+001/-1.6158e+002)= 1.0999
The true phase is: pahse(x[6])-pi/2 = -0.4709
Why i have to subtract pi/2
?
if i use atan2(imag(X(6)),real(X(6)))
- first image
if i use atan(imag(X(6))/real(X(6)))-pi/2
- second image
You are experiencing quadrant ambiguity. The range of atan()
is [-pi/2 ... +pi/2]
with repetitions when going outside that range. This means, you cannot uniquely determine the correct quadrant of your angle, when that angle happens to be on the "other side" of the circle.
To avoid this sort of thing, use angle
(or phase
) and/or atan2
(the 4-quadrant version of atan
):
>> X = -8.2257e+001 - 1.6158e+002i;
>> angle(X)
ans =
-2.041680802478084e+000
>> atan2(imag(X), real(X))
ans =
-2.041680802478084e+000