Question

I'll try and ask specific questions here:-

I'm using python to look at some relatively basic DSP, and I'd like to implement Automatic Gain Control. Unless I'm mistaken this takes the (simplified) form:

enter image description here

I'm not too concerned by phase shifts between the i/o signals and the input signal is 1MHz sine wave modulated by a slowly varying wave (as indicated above) and I'm sampling at 40MHz. My questions are:

(i) I'm unable to find any decent description on AGC, suggestions for this are welcome.

[I have a very good book on general DSP, but AGC is only mentioned in passing]

I know the basic idea of low in-signal then high gain, and vice versa; and I also appreciate a filter generating the 'fast attack'/'slow decay' response, but I'm unsure of details on AGC algorithms within DSP.

Secondly:

(ii) How may I achieve this within python? My starting code is something like this:

import numpy as np
import pylab as plt

# 1000 samples of a 1MHz signal, sampled at 40MHz
sample_rate = 40e6
fc          = 1e6
fm          = 1e5
nsamples    = 1000

# for now assume an AM type signal  
t = np.arange(nsamples) / sample_rate
signal = np.sin(2*np.pi*fc*t) * ( (1 + np.sin(2*np.pi*fm*t))/2 )

plt.plot(t, signal)
plt.grid()
plt.xlabel('time (0 to 25us)')
plt.ylabel('ip signal amplitude')
plt.show()

enter image description here

Was it helpful?

Solution

Such things are often modeled in Matlab and its language is pretty similar to Python. Check out in Google. You may start here. It's a free chapter from the book Perez, Automatic Gain Control

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top