Recently, I was going through my undergraduate lecture notes. I stumbled upon an exercise which I found interesting. The task consisted in implementing the algorithm proposed by Pei and Tseng, which uses vector projection to minimize the problem of transient values when applying an IIR notch filter to an ECG signal.
A complete, detailed explanation of it can be found in
Pei, Soo-Chang, and Tseng, Chien-Cheng. “Elimination of AC interference in electrocardiogram using IIR notch filter with transient suppression”. Biomedical Engineering, IEEE Transactions on 42.11 (1995): 1128-1132.
Full credit goes to the authors.
I decided to implement it in MATLAB and in Python. You can find the submission in my GitHub repository, which includes sample ECG data (as a
.mat file) as well as a main/demo file, which I suggest you to try in order to understand how it works. The scripts include plenty of comments in which I tried to explain each of the steps as clear as possible.
If you have any questions, comments, or feedback, please open a discussion. If there is a problem with the code (e.g., mistake), please open an issue. You can always drop me a line on Twitter (@amoncadatorres). Lastly, if you found this useful, fun, or just want to show your appreciation, you can always buy me a cookie. Cheers!