Main Content

AGC

Adaptively adjust gain for constant signal-level output

  • AGC Block

Libraries:
Communications Toolbox / RF Impairments Correction

Description

The automatic gain controller (AGC) block adaptively adjusts its gain to achieve a constant signal level at the output.

This icon shows the AGC block with the optional Px port.AGC block with optional ports shown

Examples

expand all

The doc_agc_received_signal_amplitude model uses an AGC block to adjust the received signal power to approximately 1 watt.

A constellation diagram displays the signal before and after the signal level is adjusted by the AGC block. Random integer-valued symbols are QPSK modulated and then the signal level is scaled down by using a Gain block. The AGC block adjusts the signal to achieve a desired power level of 1 W. A constellation diagram displays the signal input to and output from the AGC block.

Run the model and display the constellation diagram to show the signal level adjustments performed by the AGC block.

This model uses AGC blocks with different step size settings to adjust the received signal power.

A time scope plots the effect of step size on AGC performance. Random integer-valued symbols are QPSK modulated and then the signal level is scaled down by using a Gain block. Three signal branches flow to a time scope to plot the received signal magnitude with no AGC, AGC with step size set to 0.0001, and AGC with step size set to 0.001.

Run the model and display the time scope to show the signal level adjustments performed by the AGC blocks.

This model uses AGC blocks with different maximum gain settings to adjust the received signal power.

A time scope plots the effect of maximum gain on AGC performance. The maximum gain setting affects the ability of the AGC to reach its target output power. Random integer-valued symbols are QPSK modulated and then the signal level is scaled down by using a Gain block. Three signal branches flow to a time scope to plot the received signal magnitude with no AGC, AGC with maximum gain set to 30 dB, and AGC with maximum gain set to 24 dB.

Run the model and display the time scope to show the signal level adjustments performed by the AGC blocks.

Ports

Input

expand all

Input signal, specified as a column vector.

Data Types: single | double | int | uint
Complex Number Support: Yes

Output

expand all

Output signal, returned as an NS-element column vector. NS is the length of the input signal. The output signal is the same data type as the input signal.

Power level estimate, returned as an NS-element column vector. NS is the length of the input signal. You can use powerlevel as an energy detector output.

Dependencies

To enable this port, select the Enable output of estimated input power parameter.

Parameters

expand all

To edit block parameters interactively, use the Property Inspector. From the Simulink® Toolstrip, on the Simulation tab, in the Prepare gallery, select Property Inspector.

Step size for gain updates, specified as a positive scalar. Increasing the step size enables the AGC to respond more quickly to changes in the input signal level but increases variation in the output signal level after reaching steady-state operation. For more information, see AGC Performance Criteria.

Target output power level, specified as a positive scalar. The power level is measured in watts referenced to 1 ohm.

Length of the averaging window in samples, specified as a positive integer. For more information on how the averaging length influences the variance of the AGC output signal in steady-state operation and the execution speed, see Tips.

Maximum power gain in decibels, specified as a positive scalar. Large gain adjustments can cause clipping when a small input signal power suddenly increases. Use this property to avoid large gain adjustments by limiting the gain that the AGC applies to the input signal. For an example, see Compare AGC Performance for Different Maximum Gains.

Select this check box to provide an output port, Px, that returns an estimate of the input signal power.

Type of simulation to run, specified as Interpreted execution or Code generation.

  • Interpreted execution — Simulate the model by using the MATLAB® interpreter. This option requires less startup time, but the speed of subsequent simulations is slower than with the Code generation option. In this mode, you can debug the source code of the block.

  • Code generation — Simulate the model by using generated C code. The first time you run a simulation, Simulink generates C code for the block. The model reuses the C code for subsequent simulations unless the model changes. This option requires additional startup time, but the speed of the subsequent simulations is faster than with the Interpreted execution option.

For more information, see Interpreted Execution vs. Code Generation (Simulink).

Block Characteristics

Data Types

double | single

Multidimensional Signals

no

Variable-Size Signals

yes

More About

expand all

Tips

  • This block is designed for streaming applications.

  • If the signal amplitude does not change within the frame, you can simulate an ideal AGC by calculating the average gain desired for a frame of samples. Then, apply the gain to each sample in the frame.

  • If you use the AGC with higher order QAM signals, you might need to reduce the variation in the gain during steady-state operation. Inspect the constellation diagram at the output of the AGC during steady-state operation. You can increase the averaging length to avoid frequent gain adjustments. An increase in averaging length reduces execution speed.

Extended Capabilities

C/C++ Code Generation
Generate C and C++ code using Simulink® Coder™.

Version History

Introduced in R2013a

See Also

Objects