# Loop bandwidth for Costas loop

How do the alpha & beta parameters referenced in this implementation of a software based digital phase locked loop relate to the loop bandwidth, in Hz? The loop filter equations gleaned from the code appear to be:

$$f_n=f_{n−1}+ \beta\epsilon_n \tag 1$$ $$\phi_n = \phi_{n-1} + f_n + \alpha\epsilon_n \tag 2$$

where $$f_n$$ is the present frequency estimate, $$\phi_n$$ is the present phase estimate, and $$\epsilon_n$$ is the present error (multiplication of the real and imaginary components in the Costas loop). [Thanks to @Peter K. for clarification here]

• Sorry, it's not clear what these proportional and derivative constants mean. Maybe you have some specific loop filter design in mind? We can't know that! Please show the formula, a block diagram, or something else that shows the relationship between the costas loop and these constants. Commented Oct 23, 2022 at 12:56
• Added a block diagram. Does that help? I am referencing this implementation: pysdr.org/content/sync.html#fine-frequency-synchronization Commented Oct 23, 2022 at 13:28
• ah Marc's Pysdr! The diagram would help if it was a first-order PID controller architecture, but it's not – and the text also does not mention any proportional and derivative constants. So, I'm not sure where you take these from? Why do they apply to this? Commented Oct 23, 2022 at 13:37
• Proportional and derivative are terms I've seen in a lot of online resources and texts: 1. en.wikipedia.org/wiki/Phase-locked_loop - under "Filter" section 2. web.ece.ucsb.edu/~long/ece594a/PLL_intro_594a_s05.pdf I can remove those terms if it's confusing. I'm wondering about the alpha and beta values. Commented Oct 23, 2022 at 13:43
• Your block diagram does not show any alpha or beta values. Presumably these are in embedded in the loop filter, but such things aren't always standard. You need to show us how the loop you are implementing uses $\alpha$ and $\beta$ -- preferably by editing your question to give us the difference equation or the transfer function of the loop filter. Commented Oct 23, 2022 at 23:06

I don't believe there's a direct relationship.

The effective filtering that is happening looks like: \begin{align} f_n &= f_{n-1} + \beta \epsilon_n\\ \phi_n &= \phi_{n-1} + f_n + \alpha \epsilon_n \end{align} where $$f_n$$ is the present frequency estimate, $$\phi_n$$ is the present phase estimate, and $$\epsilon_n$$ is the present error (multiplication of the real and imaginary components in the Costas loop).

Just looking at a generic first order system: $$x_n = x_{n-1} + \alpha \epsilon_n \leftrightarrow (1-z^{-1})X(z) = \alpha E(z)$$ so that $$\frac{X(z)}{E(z)} = \frac{\alpha}{1 - z^{-1}}$$

Which, in Matlab, looks like

alpha = 0.132
beta = 0.00932

b = alpha;
a = [1 -1];

freqz(b,a, 512, 44100)


which shows the following frequency response if your sampling rate is 44.1 kHz.

• Is the idea to use the frequency response to measure the 3dB loop bandwidth (i.e., 3 dB down from the peak of the response)? Commented Oct 24, 2022 at 16:02
• @BigBrownBear00 : Yes, that could be one way to get a loop bandwidth out of the equations in your linked page (that I've tried to write in my answer).
– Peter K.
Commented Oct 24, 2022 at 16:33
• Thanks for taking the time to clarify my question based on the link provided. I added it to the original question for clarity. Appreciate the help! Commented Oct 24, 2022 at 16:46