4

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 <code>atan2(imag(X(6)),real(X(6)))</code> if i use <code>atan(imag(X(6))/real(X(6)))-pi/2</code>

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

Elod
  • 499
  • 9
  • 25
  • Are you using `atan` or `atan2`? You're code uses `atan` but you've tagged `atan2`. – Doresoom Jun 12 '13 at 13:12
  • sorry my mistake, there is no atan tag, but i'm using the atan() fnc. – Elod Jun 12 '13 at 14:35
  • Use `atan2` then. Problem solved. – Doresoom Jun 12 '13 at 14:40
  • Like @Rody Oldenhuis suggested, but that nether works `atan2(imagX,realX)=-2.04` but the phase is **-0.4709** as i mentioned above. – Elod Jun 12 '13 at 14:54
  • 1
    Are you sure the measurement didn't assume cosines where you use sines, or vice versa, or something? Based on those numbers, it's the *measurement's* phases which are incorrect... – Rody Oldenhuis Jun 13 '13 at 08:10

1 Answers1

7

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
Rody Oldenhuis
  • 37,726
  • 7
  • 50
  • 96
  • second `ans =-2.0...` but if i run with this code i have a larger phase difference then earlier. I know for sure that the result should be **-0.4709** – Elod Jun 12 '13 at 14:40
  • @Elod: just look at your values -- minus 80 something in `x` direction (real axis) and minus 160-something in `y` direction (imaginary axis), that's an angle of roughly 45 degrees *beyond* negative 90 degrees, therefore, roughly minus 135 degrees (-2.3 something radians). So your -0.4 radians just don't make any sense... – Rody Oldenhuis Jun 12 '13 at 16:05
  • I totally understand and agree with you, however if i use that phase shift the result is the first image attached to my post. – Elod Jun 12 '13 at 17:25