I have a DPLL that's trying to lock to a DSB-SC input signal with a carrier whose phase is $\theta$. So after some mixing and filtering (Costas Loop), I have these two signals ($\hat{\theta}$ is the estimated phase by the DPLL):
$$ s_I(t) = 0.5x(t)cos(\theta-\hat{\theta}) $$ $$ s_Q(t) = 0.5x(t)sin(\theta-\hat{\theta}) $$
And the output of my phase detector is: $$ q(t)=atan\left(\frac{s_I(t)}{s_Q(t)}\right)=atan\left(\frac{sin(\theta-\hat{\theta})}{cos(\theta-\hat{\theta})}\right)=atan(tan(\theta-\hat{\theta})) $$
But as you know, $atan(tan(\theta-\hat{\theta}))=\theta-\hat{\theta}$ only if $-\frac{\pi}{2}\leq(\theta-\hat{\theta})\leq\frac{\pi}{2}$.
I know how I could adjust $\theta-\hat{\theta}$ so that they fall within the accepted range. The thing is, I don't have access to $\theta-\hat{\theta}$ but to $s_I(t)$ and $s_Q(t)$.
What could be done to guarantee there's no phase ambiguity? I mean, I can adjust only $\hat{\theta}$ since I'm generating it, but adjusting that one doesn't mean that $-\frac{\pi}{2}\leq(\theta-\hat{\theta})\leq\frac{\pi}{2}$ will be true.
atan2function which gives a value between $-\pi$ and $+\pi$. – Dilip Sarwate Oct 10 '19 at 19:53atan2and you will get the value of $\theta -\hat\theta$ which is guaranteed to lie in $[-\pi,\pi]$, – Dilip Sarwate Oct 10 '19 at 21:24