# Costas Loop not Locking (Solved)

**URL:** <https://www.ruby-forum.com/t/costas-loop-not-locking-solved/168571>\
**Category:** GNU Radio\
**Created:** [May 22, 2009, 3:49pm UTC](https://www.ruby-forum.com/t/costas-loop-not-locking-solved/168571 "2009-05-22T15:49:41Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Tom\_Lutz](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/ecccb3/32.png) [@Tom\_Lutz](https://www.ruby-forum.com/u/Tom_Lutz)\
**Post date:** [May 22, 2009, 3:49pm UTC](https://www.ruby-forum.com/t/costas-loop-not-locking-solved/168571/1 "2009-05-22T15:49:41Z")

</div>

I was having a very difficult time trying to get a Costas Loop to work  
yesterday for order=2. I discovered, by the end of the day, several  
things:

1. Min and Max frequency are in Radians per Sample (the documentation  
says ‘normalized’, but I wasn’t sure whether it meant cycles/sample or  
radians/sample)
2. The loop likes a signal that lies on the unit circle (i.e.  
magnitude=1). I was using unscaled data that ranged from -150 to  
150…not so good! I used Automatic Gain Control to fix this.

I used a nominal value of 0.01 for alpha and alpha^2/4 for beta, but I  
suppose you should tweak these by testing the response of the loop for  
various stimuli.

I think I’ll update the documentation to make things more explicit.

Cheers,  
Tom

---

<div class="post-metadata">

**Author:** ![Tom\_Lutz](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/ecccb3/32.png) [@Tom\_Lutz](https://www.ruby-forum.com/u/Tom_Lutz)\
**Post date:** [May 22, 2009, 4:33pm UTC](https://www.ruby-forum.com/t/costas-loop-not-locking-solved/168571/2 "2009-05-22T16:33:39Z")

</div>

On Fri, May 22, 2009 at 09:42:00AM -0400, Tom Lutz wrote:

> I was having a very difficult time trying to get a Costas Loop to work  
> yesterday for order=2. I discovered, by the end of the day, several  
> things:
> 
> 1. Min and Max frequency are in Radians per Sample (the documentation  
> says ‘normalized’, but I wasn’t sure whether it meant cycles/sample or  
> radians/sample)

Fixed in the .h file. Not yet committed.
