1
$\begingroup$

I have an embedded application that does some phase modulation and streams back the phase offsets it's applying over UDP. I now want to take the FFT to see the spectrum of the applied modulation. Since it's phase data, it wraps around $0$ and $2 \, \pi$, which gives me some spurs in my FFT.

What's the best way of doing this?

$\endgroup$
1
  • $\begingroup$ Unwrap the phase first? $\endgroup$ Commented May 3 at 21:16

2 Answers 2

3
$\begingroup$

The best solution is to unwrap the phase data before computing the fft.

Matlab's unwrap function works as follows: Whenever the jump between consecutive angles is greater than or equal to π radians, unwrap shifts the angles by adding multiples of ±2π until the jump is less than π.

$\endgroup$
1
$\begingroup$

Another sleazy way to unwrap phase is:

phase = cumsum([angle(X(1)); angle( X(2:N/2) ./ X(1:N/2-1) ) ]);

You still have to discern the phase at DC. Which is polarity. So it's either $\pm \pi$ (if the polarity is inverted at DC) or $0$.

I should not state it solely in MATLAB language. Their indices in the FFT are off-by-one.

$$ X[k] = \big| X[k] \big| \, e^{j \phi[k]} $$

$$ \phi[k] = \arg\big\{ X[k] \big\} $$

so

$$ \phi[k] - \phi[k-1] = \arg\left\{ \frac{X[k]}{X[k-1]} \right\} $$

or

$$ \phi[k] = \phi[0]+\sum\limits_{i=1}^{k} \arg\left\{ \frac{X[i]}{X[i-1]} \right\} $$

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.