Digital Automatic Gain Control Theory