- class sdr.AGC
Implements an automatic gain controller (AGC).
Notes
x[n] -->X---------------------------------------------------------------------+--> y[n] ^ | | | +--------+ +------+ -1 +--------+ +-------+ | | exp(.) |<--+--| z^-1 |<--@<---X<--------@<-----| log(.) |<--| |.| |<--+ +--------+ | +------+ ^ alpha log(R) +--------+ +-------+ | | or beta +-------------+ x[n] = Input signal y[n] = Output signal alpha = Attack rate beta = Decay rate R = Reference magnitude @ = Adder X = Multiplier
References
Michael Rice, Digital Communications: A Discrete-Time Approach, Section 9.5.
Examples
Create an example received signal with two bursty signals surrounded by noise.
In [1]: x = np.exp(1j * 2 * np.pi * np.arange(5000) / 100); \ ...: x[0:1000] *= 0; \ ...: x[1000:2000] *= 10; \ ...: x[2000:3000] *= 0; \ ...: x[3000:4000] *= 0.1; \ ...: x[4000:5000] *= 0 ...: In [2]: x += 0.001 * (np.random.randn(x.size) + 1j * np.random.randn(x.size)) In [3]: plt.figure(); \ ...: sdr.plot.time_domain(x); \ ...: plt.title("Input signal"); ...:
Create an AGC with an attack rate of \(\alpha = 0.5\) and a decay rate of \(\beta = 0.01\). Notice that over time the noise is amplified (according to the decay rate). Also notice that when the signal of interest appears the AGC gain is quickly decreased (according to the attack rate).
In [4]: agc = sdr.AGC(0.5, 0.01) In [5]: y = agc(x) In [6]: plt.figure(); \ ...: sdr.plot.time_domain(y); \ ...: plt.ylim(-1.5, 1.5); \ ...: plt.title("Output signal"); ...:
Constructors¶
-
AGC(attack: float, decay: float, reference: float =
1.0
, ...) Creates an automatic gain controller (AGC).
Special methods¶
Streaming mode only¶
Properties¶