CHECKPOINT: Fixed issues where:
1. The algorithm produced weird values for signals where the leads were switched
   Fixed this by replacing the peak values of x1(i) with sqrt(x5) x5 being the square of the signal.
   This provides the nice balance of giving x1 when the signal is not inverted and abs(x) when the signal is inverted.

2. The emulator now averages over 4 sample windows to provide more stability with the introduction of noise