# AGC

• Library:
• 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.

## 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

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 than the `Code generation` option, but the speed of subsequent simulations is slower. 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 C code is reused for subsequent simulations unless the model changes. This option requires additional startup time, but the speed of the subsequent simulations is faster than `Interpreted execution`.

## Block Characteristics

 Data Types `double` | `single` Multidimensional Signals `no` Variable-Size Signals `yes`

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.

## Version History

Introduced in R2013a