<< Chapter < Page | Chapter >> Page > |
Accordingly, an implementable version of the Costas loop can be built as
This is diagrammed in [link] , leaving off the first (or outer) averaging operation (as is often done),since it is redundant given the averaging effect of the two LPFs and the averaging effect inherent in thesmall stepsize update. With this averaging removed, the algorithm is
Basically, there are two paths. The upper path modulates by a cosine and then lowpass filters to create [link] , while the lower path modulates by a sine waveand then lowpass filters to give . These combine to give the equation update, which is integratedto form the new estimate of the phase. The latest phase estimate is then fed back (this is the “loop”in “Costas loop”) into the oscillators, and the recursion proceeds.
Suppose that a 4-PAM transmitted signal
r
is created as
in
pulrecsig.m
with carrier frequency
fc=1000
. The Costas loop
phase tracking method
[link] can be implemented
in much the same way that the PLL was implemented in
pllconverge.m
.
r=rsc; % rsc is from pulrecsig.m
fl=500; ff=[0 .01 .02 1]; fa=[1 1 0 0];h=firpm(fl,ff,fa); % LPF design
mu=.003; % algorithm stepsizef0=1000; % assumed freq. at receiver
theta=zeros(1,length(t)); theta(1)=0; % initialize estimate vectorzs=zeros(1,fl+1); zc=zeros(1,fl+1); % initialize buffers for LPFs
for k=1:length(t)-1 % z's contain past fl+1 inputs zs=[zs(2:fl+1), 2*r(k)*...
sin(2*pi*f0*t(k)+theta(k))];
zc=[zc(2:fl+1), 2*r(k)*... cos(2*pi*f0*t(k)+theta(k))]; lpfs=fliplr(h)*zs'; lpfc=fliplr(h)*zc'; % new output of filters
theta(k+1)=theta(k)-mu*lpfs*lpfc; % algorithm updateend
costasloop.m simulate costas loop with input from pulrecsig.m
(download file)
Typical output of
costasloop.m
is shown in
[link] , which shows the evolution of the phase
estimates for 50 different starting values
theta(1)
.
A number of these converge to
, and a number to
nearby
multiples. These stationary points occur at all
the maxima of the error surface (the bottom plot in
[link] ).
When the frequency is not exactly known, the phase estimates of the Costas algorithm try to follow. For example, in [link] , the frequency of the carrier is , while the assumed frequency at the receiver was . Fifty different starting points are shown, and in all cases, the estimates converge to a line. "Frequency Tracking" shows how this linear phase motion can be used to estimate the frequency difference.
Notification Switch
Would you like to follow the 'Software receiver design' conversation and receive update notifications?