Theoretical analysis of T-wave polarity based on a model of cardiac electrical activity