CalculateApEn function

Calculates Approximate Entropy