Single-beat ECG template generation