I am trying to understand the automatic gain control block provided by the communications toolbox. The documentation is here: Documentation

My questions are in regards to two of the configurable parameters, the DesiredOutputPower and MaxPowerGain.

Given a value X for DesiredOutputPower, how does one compute what the reference value A is?

Given a value X for MaxPowerGain, how does one compute what the upper limit for g is?

For example:

If DesiredOutputPower = 2 then A = 0.693147180559945

If DesiredOutputPower = 6 then A = 1.791759469228055


If MaxPowerGain = 10 then the upper limit for g is 1.15129255

If MaxPowerGain = 60 then the upper limit for g is 6.90775527

The documentation in regard to DesiredOutputPower states:

Specify the desired output power level as a real positive scalar. The power is measured in Watts referenced to 1 ohm. The default is 1.

And in regard to MaxPowerGain:

Maximum power gain in decibels

Specify the maximum gain of the AGC in decibels as a positive scalar. The default is 60.

How are these numbers determined? What are the formulas? I've been trying to apply the formulas I read here: The dB in Communications but I havent been able to figure it out, please help.

Thank you!


From the diagram in the Algorithms section of the documentation you can see how the different quantities are computed: enter image description here

Note that $z$ in the diagram is an estimate of the output power.$^1$ The error signal $e$ is computed by comparing the reference value $A$ to $\ln(z)$. So if you choose $$A=\ln(P)\tag{1}$$ then the average output power will be adjusted to the specified value $P$.

Concerning the maximum gain, note that the input is multiplied by $\tilde{g}=e^g$. If $G$ is the maximum gain in dB, you have the following relationship:




and, consequently,

$$g=\ln(\tilde{g})=G\cdot \frac{\ln(10)}{20}\approx G\cdot 0.11513\tag{4}$$

1. There is an error in the diagram: the output of the detector must be multiplied by the square of the gain (because it's an estimate of the power). This is correctly represented by the equations below the diagram in the documentation.

  • $\begingroup$ Thank you, exactly what i was looking for! $\endgroup$ Nov 21 '19 at 1:12
  • $\begingroup$ Do you mean the equation for z(n)? Could you please explain that further because I don't understand why there is a 2 in it? $\endgroup$ Nov 24 '19 at 20:40
  • $\begingroup$ @yellow_watermelon: Because the output of the detector is an averaged square value of its input, so you need to multiply by the squared gain to get an estimate of the output power. $\endgroup$
    – Matt L.
    Nov 24 '19 at 20:43
  • $\begingroup$ So exp(2g(n-1)) is equivalent to squaring the gain value g? $\endgroup$ Nov 24 '19 at 21:37
  • $\begingroup$ @yellow_watermelon: Note that the input is not multiplied by $g$ but by $\exp(g)$. So squaring that constant results in $\exp(2g)$. $\endgroup$
    – Matt L.
    Nov 25 '19 at 20:24

enter image description here

Hi I am confused about the implementation of AGC in Simulink example.

I am unable to relate the given implementation to the algorithm given by MATLAB.

Kindly help me in understanding the reason behind the difference in algorithm and implementation.

Best Regards Sunny


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.