# Phase correction algorithm: minimisation phase error

I am working on the implementation of a phase correction.

Currently, I have finished the algorithm. I think it is a standard algorithm everyone of you uses.

Actually, it is the standard algorithm to correct a phase; I think.

1. Does anyone have an idea of how can I minimize the difference between angles of adjacent samples/symbols?

2. Had someone already an experience with such simulation and probably had still the simulation script and can share it with me?

I commend you for using an intuitive algorithm. However, there are already established algorithms with far better performance. Phase recovery algorithms work by filtering the error signal down to zero. An example is the Costas loop structure shown in the figure below for QPSK.

Let's start with phase error detectors (Highlighted in yellow). The arctan detector you used in your example works but it's not typically used in practical systems (The division of imaginary/real may result in overflow if the real quantity is very small). Most systems use the Costas and maximum-likelihood error detectors. Taking BPSK for example. The Costas phase error detector is simply ($$real\times imag$$). Error detectors are characterized by an S-curve obtained by finding the expectation of the error detector output (For BPSK should be the mean of ($$real\times imag$$)) for different phase error inputs (phase errors from $$-\pi$$ to $$\pi$$ in steps of $$\frac{pi}{N}$$) as shown below.

Filtering is done by something called the loop filter that can "drive" the error down to zero. The proportional-plus-integrator shown below is widely used at it can drive both static phase error and frequency offset to zero. $$K_{n}$$ parameters (which depend on the slope of the S-curve) dictate the behavior of the loop.

Regarding examples. There are plenty of examples online such as this one. You could find many more by searching for Costas loop examples online. If interested, you could have a look at GNU Radio tutorials. Plenty of examples too.

And finally, I could suggest some improvement in your simulation. You should consider adding a small frequency offset as well as phase noise to fully represent a real-world scenario.

Good luck.

• the phase correction is done in freq domain, the timing correction is done in time domain, isnt? – Jang Lee May 25 at 7:54
• I have done both in time domain. But I suppose they can also be done in the frequency domain. – Moses Browne Mwakyanjala May 25 at 10:24