Method and System for Measuring the Energy of a Signal