# Carrier frequency offset (CFO) estimation using cyclic prefix

I understand the cyclic prefix, but in (1) it's said that: "If we consider that the channel effect is minimal and can be neglected. then the phase difference of the CP and the OFDM symbol which the victim of CFO can be found by $2\pi\beta N/N= 2\pi\beta$." and then, the author derives the equation for estimating the CFO $\beta$. My questions are:

1. How is this phase difference between the cyclic prefix (CP) and the corresponding rear part of an OFDM symbol obtained?
2. I'm confused about how the cyclic prefix is used to estimate the carrier frequency offset. Can you explain how the formula for $\beta$ is derieved?

Reference

To understand the equation in question consider how frequency offset $f_\mathrm{off}$ affects the received signal $r(t)$. For simplicity the authors assume the noise-free case and a frequency flat channel, i.e. the received signal before frequency offset is equal to the transmitted signal $s(t)$. Frequency offset is a frequency shift and can be expressed in time domain by $$r(t) = s(t) \mathrm{e}^{j2\pi f_\mathrm{off}t}.$$ The received signal is now sampled at $t = n/F_\mathrm{s},\, n\in\mathbb{Z}$, where $F_\mathrm{s}$ is the sampling frequency. This yields $$r(n/F_\mathrm{s}) = s(n/F_\mathrm{s}) \mathrm{e}^{j2\pi n f_\mathrm{off}/F_\mathrm{s}}.$$ In the following we write $r_n$ and $s_n$ for $r(n/F_\mathrm{s})$ and $s(n/F_\mathrm{s})$, respectively. The authors introduce the normalized frequency offset $\beta = f_\mathrm{off}/\Delta f$ but they don't define what $\Delta f$ is. From the context I understand that it is the subcarrier spacing $\Delta f = F_\mathrm{s}/N$, where $N$ is the number of subcarriers. Using this relationship we can rewrite the above equation as a function of $\beta$: $$r_n = s_n \exp\left(j2\pi \frac{\beta}{N}n \right).$$ Next we consider a received cyclic prefix sample at $n$ (see above) and the corresponding received payload data sample $N$ samples apart at $n+N$: $$r_{n+N} = s_{n+N} \exp\left(j2\pi \frac{\beta}{N}(n+N) \right) = s_{n} \exp\left(j2\pi\beta + j2\pi \frac{\beta}{N}n \right)$$ In the above equation we have exploited that the cyclic extension is just a copy of the last $N_\mathrm{g}$ samples of an OFDM symbol and therefore $s_{n+N} = s_{n}$ (for all $s_{n}$ that are in the cyclic prefix). We can now see that the phase difference between the cyclic prefix and its corresponding data samples is $\arg(r_n^* r_{n+N})=2\pi\beta$ which is the answer to your first question. It is now easy to obtain an estimate $\hat\beta$ of $\beta$ $$\hat\beta = \frac{1}{2\pi}\arg(r_n^* r_{n+N})$$ It's just an estimation because in reality the received signal is corrupted by noise and channel distortion. The estimation can be improved by not only comparing one cyclic prefix and data sample but all $N_\mathrm{g}$ cyclic prefix samples with their respective copies. This is done by adding all $r_n^* r_{n+N}$ in the cyclic prefix and answers your second question about how the formula for $\beta$ is derived.

In addition to Deve's very good answer above, it should be noted that the phase difference $\arg(r_n^* r_{n+N})=2\pi\beta$ is circular and you cannot tell the difference between $0, 2\pi, 4\pi, ...$. In the given case this means that $\beta$ is limited to the range $[0...1]$ or $[-0.5...0.5]$. Therefore, this technique only removes the CFO completely if $|f_{off}|<\frac{\Delta f}{2}$. In all other cases, $\beta$ will be estimated (in the optimal case) such that $\frac{f_{off}}{\Delta f} + \beta$ becomes integer and hence, the resulting CFO after removing the estimated part is an integer multiple of the subcarrier spacing. In that process it can easily happen, that removing the estimated CFO actually increases the CFO of the signal.
For that reason, what this technique actually does is estimating (and later removing) fractional carrier frequency offset which is only equivalent to carrier frequency offset estimation if $|f_{off}|<\frac{\Delta f}{2}$. However, if the fractional CFO is removed, this avoids the inter-carrier-interference it causes. What remains is a cyclic shift of the OFDM carriers caused by the remaining CFO that is a multiple of the carrier spacing. So there should be some pilot carriers that allow the detection of such a case.