Documentation |
Adaptively adjust gain for constant signal-level output
This automatic gain controller (AGC) block adaptively adjusts its gain to achieve a constant signal level at the output.
Specify the method that the block uses to perform envelope detection. The default is Rectifier.
When you select Rectifier, the AGC detector outputs a voltage value proportional to the envelope amplitude of the output signal. The detector rectifies and then averages the input signal over the period of gain updates in samples. The AGC adjusts the gain to obtain unity voltage at the output of the detector.
When you select Square law, the AGC detector outputs a power value that is proportional to the square of the output voltage. The detector squares and then averages the input signal over the period of gain updates in samples. The AGC adjusts the gain to obtain unity power at the output of the detector.
Specify the AGC loop implementation that the block uses. The default is Linear.
When you select Linear, the AGC uses the direct value of the detector output to determine the gain value. Typically, a linear loop responds quickly to increases in the input signal level. However, the loop's response to decreases in the input signal level tends to be slow.
When you select Logarithmic, the AGC uses the logarithm of the detector output to determine the gain value. Logarithmic loops respond to decreases in the input signal level much more quickly than linear loops.
Specify the period of the gain updates as a double- or single-precision, real, integer-valued scalar. The default is 100.
The number of input samples must be an integer multiple of this parameter value. Setting the period greater than 1 increases the speed of the AGC algorithm.
If you increase the period of the gain updates, you may also need to increase the step size. Similarly, if you decrease the period of the gain updates, you may also need to decrease the step size.
Specify the step size for gain updates as a double- or single-precision, real, positive scalar. The default is 0.1.
If you increase the loop gain, the AGC responds to changes at the input signal level faster. However, gain pumping also increase.
If you increase the period of the gain updates, you may also need to increase the step size. Similarly, if you decrease the period of the gain updates, you may also need to decrease the step size.
Specify the maximum gain of the AGC in decibels as a positive scalar. The default is 30.
If the input signal to the AGC has a very low signal level, the AGC gain may increase rapidly. Use this parameter to limit the gain that the AGC applies to the input signal.
Select this check box to enable a secondary block output port. This port displays the gain that the AGC applies to the input signal.
In a linear loop AGC, the detector uses its output directly to generate an error signal. After applying a step size, the AGC passes the error signal to an integrator. The output of the integrator is used as the variable gain. Linear loop AGCs are limited by their decay, or slew, characteristics. In other words, they respond to input signal increases much more quickly than they respond to input signal decreases.
$$\begin{array}{l}y(n)=g(n)\cdot x(n);\\ e(n)=A-z(m);\\ g(n+1)=g(n)+K\cdot e(n);\end{array}$$
where
A represents the reference value, which is 1
K represents the step size
e represents the error signal
g represents the gain
x represents the input signal
y represents the output signal
z represents the detector output
In a logarithmic loop AGC, the logarithm of the ratio of the detector output and the reference signal represents the error signal. A logarithmic loop uses the exponential of the integrator output as the gain signal. Logarithmic loop AGCs have the same response time to both increases or decreases to the input signal amplitude.
The logarithmic loop has longer attack and decay times. However, the gain pumping of the logarithmic loop is better than that of the linear loop.
$$\begin{array}{l}y(n)={e}^{g(n)}\cdot x(n);\\ e(n)=ln(A)-\mathrm{ln}(z(m));\\ g(n+1)=g(n)+K\cdot e(n);\end{array}$$
where
A represents the reference value, which is 1
K represents the step size
e represents the error signal
g represents the gain
x represents the input signal
y represents the output signal
z represents the detector output
Two AGC detectors are available:
z = |y| when the detector represents a rectifier
$$z(m)=\frac{1}{N}{\displaystyle {\sum}_{n=mN}^{(m+1)N-1}\left|y(n)\right|}$$
where N represents the period of the gain updates
z = |y|^{2} represents the square law detector
$$z(m)=\frac{1}{N}{\displaystyle {\sum}_{n=mN}^{(m+1)N-1}{\left|y(n)\right|}^{2}}$$
where N represents the period of the gain updates
There are three performance criteria for AGCs:
Attack time: The duration it takes the AGC to respond to an increase in the input amplitude.
Decay time: The duration it takes the AGC to respond to a decrease in the input amplitude.
Gain pumping: The variation in the gain value during steady-state operation.
Increasing the step size decreases the attack time and decay times, but it also increases gain pumping.
To openopen an example that adaptively adjusts the received signal amplitude to approximately 1 volt, type doc_agc_received_signal_amplitude at the MATLAB^{®} command line.
To openopen an example that compare the performance of an AGC with a rectifier detector and a square law detector, type doc_agc_compare_rectifier_and_square_law at the MATLAB command line.
Top openopen an example that plots the effect of step size on AGC performance, type doc_agc_plot_step_size at the MATLAB command line.
To openopen an example that plots the effect of maximum gain on burst signals, type doc_agc_plot_max_gain at the MATLAB command line.