DSPRelated.com
Forums

Carrier recovery system for QPSK

Started by Dinuka May 24, 2012
Hi All,

I want to implement a carrier recovery system in Matlab for a
quadrature QPSK system. First i want to recover the phase offset and
then to recover the frequency offset. According to some digital
communications reference books there are multiple ways to achieve
this.

1). Power of 4 PLL
2) Costas loops - There are different approaches in different
documents.

I have tried to follow the power of 4 method. But I'm struggling with
the matlab coding to calculate the original phase. I haven't used
matlab before for these type of analog simulations.

I would highly appreciate if someone-experienced in this area can give
me an advice regarding this issue.

Thank you.
Look at some of the simulink models in this topic

http://electronix.ru/forum/index.php?showtopic=23652


On Wed, 23 May 2012 23:56:58 -0700, Dinuka wrote:

> Hi All, > > I want to implement a carrier recovery system in Matlab for a quadrature > QPSK system. First i want to recover the phase offset and then to > recover the frequency offset. According to some digital communications > reference books there are multiple ways to achieve this. > > 1). Power of 4 PLL > 2) Costas loops - There are different approaches in different documents. > > I have tried to follow the power of 4 method. But I'm struggling with > the matlab coding to calculate the original phase. I haven't used matlab > before for these type of analog simulations. > > I would highly appreciate if someone-experienced in this area can give > me an advice regarding this issue.
Which part of the code are you struggling? if r is your received signal and th (theta) is your normalized frequency, then calculate ph = r^4 * cos(th * n) where n is the index of the sample you're working at. The variable ph will consist of a bunch of high-frequency scrud with your phase error buried in it (well, with the cosine of your phase error). Get an average of ph, and that's a sorta-estimate of your phase error. I have to say, though: if you're doing this in Matlab, particularly if you're doing it in batch, there are easier ways. -- My liberal friends think I'm a conservative kook. My conservative friends think I'm a liberal kook. Why am I not happy that they have found common ground? Tim Wescott, Communications, Control, Circuits & Software http://www.wescottdesign.com
Hi,

Thanks Alexander and Tim for your responses.

Im implementing the system using Matlab codes - not using simulink.
I'm struggling with calculation of the parameters for loop filter and
VCO. I read that the VCO should be an integrator and the Loop filter
should be a low pass filter. But I dont know how to calculate the
constants. Also implementing a low pass filter is problem for me, it
always filter a part of original signal. And I'm struggling to
implement a frequency divider to get the original frequency after the
phase is locked.

Do you know any good references to implement it in matlab.

Regards.

On May 25, 2:03=A0am, Tim Wescott <t...@seemywebsite.com> wrote:
> On Wed, 23 May 2012 23:56:58 -0700, Dinuka wrote: > > Hi All, > > > I want to implement a carrier recovery system in Matlab for a quadratur=
e
> > QPSK system. First i want to recover the phase offset and then to > > recover the frequency offset. According to some digital communications > > reference books there are multiple ways to achieve this. > > > 1). Power of 4 PLL > > 2) Costas loops - There are different approaches in different documents=
.
> > > I have tried to follow the power of 4 method. But I'm struggling with > > the matlab coding to calculate the original phase. I haven't used matla=
b
> > before for these type of analog simulations. > > > I would highly appreciate if someone-experienced in this area can give > > me an advice regarding this issue. > > Which part of the code are you struggling? > > if r is your received signal and th (theta) is your normalized frequency, > then calculate > > =A0 ph =3D r^4 * cos(th * n) > > where n is the index of the sample you're working at. =A0The variable ph > will consist of a bunch of high-frequency scrud with your phase error > buried in it (well, with the cosine of your phase error). > > Get an average of ph, and that's a sorta-estimate of your phase error. > > I have to say, though: if you're doing this in Matlab, particularly if > you're doing it in batch, there are easier ways. > > -- > My liberal friends think I'm a conservative kook. > My conservative friends think I'm a liberal kook. > Why am I not happy that they have found common ground? > > Tim Wescott, Communications, Control, Circuits & Softwarehttp://www.wesco=
ttdesign.com
>Im implementing the system using Matlab codes - not using simulink.
Im implementing the system using VHDL codes, but using simulink for understanding principles. ;)
On Friday, May 25, 2012 10:05:41 PM UTC+10, Alexander Petrov wrote:
> >Im implementing the system using Matlab codes - not using simulink. > > Im implementing the system using VHDL codes, but using simulink for > understanding principles. ;)
:) Do you have any good reference. Do you have an understanding of parameters calculation (such as loop gain, bandwidth, vco constant) ?
>:) Do you have any good reference. Do you have an understanding of
parameters calculation (such as loop gain, bandwidth, vco constant) ?
>
http://ece485web.groups.et.byu.net/ee485.fall.03/lectures/synchronization_notes.pdf
>:) Do you have any good reference. Do you have an understanding of >parameters calculation (such as loop gain, bandwidth, vco constant) ?
http://ece485web.groups.et.byu.net/ee485.fall.03/lectures/pll_notes.pdf http://ece485web.groups.et.byu.net/ee485.fall.03/lectures/PLLSlides.pdf
On Fri, 25 May 2012 04:23:31 -0700, Dinuka wrote:

> Hi, > > Thanks Alexander and Tim for your responses. > > Im implementing the system using Matlab codes - not using simulink. I'm > struggling with calculation of the parameters for loop filter and VCO. I > read that the VCO should be an integrator
You almost certainly did not. You will have read that the VCO _does act_ like an integrator, not that it _should be_ an integrator. Given that you need to re-read that section, let me restate the important part: An oscillator that is putting out a constant frequency _can be seen as_ putting out a constant phase ramp. You don't _have_ to view it as putting out a constant phase ramp; you just _can_, if you _feel like it_. So, an oscillator with a controllable frequency _can be seen as_ integrating that frequency control term _into a phase ramp_. To make a controllable oscillator in Matlab, one good way to proceed _is_ to integrate your frequency command into a phase, and then (if you need it) take the sine or cosine of the phase. But that's because you're making a _simulated oscillator_ in a _pretend environment_. (Note that if you do this, then at each step in your integration you should take the phase mod 8*pi; i.e., any time your phase exceeds 8*pi subtract 8*pi from it. This will give you the same answer when you take its sine and cosine -- even after you divide it down by 4 -- but it won't get Really Large and so run into precision difficulties with floating point math).
> and the Loop filter should be > a low pass filter. But I dont know how to calculate the constants.
The loop filter can certainly _include_ a low-pass filter, but it should not be just a low-pass filter (unless you want an unstable loop). For most PLLs, the loop filter needs to be a proportional-integral controller. Again, for most PLLs, the thing needs to have a proportional gain such that the gain of your phase detector and the gain of your VCO, times your proportional gain, equals the desired bandwidth of your loop. For most PLLs -- but not yours -- the zero formed by the PI controller should be 1/4 the desired loop bandwidth. Your phase detector gain is going to be data dependent, so I'll take a stab and say that you should set your integrator gain so you have a zero at 1/10th your desired bandwidth. If you do have a low-pass filter in there, it should have a 3dB point that's 4x to 10x the intended bandwidth of the loop.
> Also > implementing a low pass filter is problem for me, it always filter a > part of original signal.
One of us is nearly completely confused. You should be low-pass filtering the control signal to the VCO, which should not be in the path of your original signal at all. It should be filtering your mostly- constant phase error. The above statement makes it sound like you have approached PLL design without any clue of what a PLL is, or perhaps even data demodulation is, and have randomly turned buzz words into elements and thrown them into a design. This approach will certainly lead to failure. Do you even have a block diagram of the thing you're trying to make? Does it make sense? If not, I suggest you get a recent copy of the Amateur Radio Relay League's "Handbook" -- they have at least one chapter in there that you'll find helpful. (They publish every year -- if you find one from 1959, it's too old. You want 2000 or more recent).
> And I'm struggling to implement a frequency > divider to get the original frequency after the phase is locked.
If you are doing the "integrate frequency into phase" approach to get your oscillator, then just divide the phase by 4 before you take the sine and cosine.
> Do you know any good references to implement it in matlab.
No, I do not know any good references on implementing it in Matlab, and if you find one it'll likely just be code. If you _understand_ it, then _implementation_ is trivial. If you have a working implementation, then understanding will still evade you. -- Tim Wescott Control system and signal processing consulting www.wescottdesign.com
On Fri, 25 May 2012 09:35:21 -0500, "Alexander Petrov"
<ux@n_o_s_p_a_m.yandex.ru> wrote:

>>:) Do you have any good reference. Do you have an understanding of >>parameters calculation (such as loop gain, bandwidth, vco constant) ? > >http://ece485web.groups.et.byu.net/ee485.fall.03/lectures/pll_notes.pdf >http://ece485web.groups.et.byu.net/ee485.fall.03/lectures/PLLSlides.pdf
These, and the link you posted previously, are pretty interesting and thorough. And I thought I was verbose! I still like the treatment below better, though. I think it's a simpler technique and maps more closely to traditional analog PLL design (maybe I'm just biased, though ;) ): http://www.compdsp.com/presentations/Jacobsen/abineau_dpll_analysis.pdf Eric Jacobsen Anchor Hill Communications www.anchorhill.com