Automatic Gain Control Algorithm Matlab