ECG Segmentation and Classification using PQRST
Show older comments
Hello MATLAB community,
I'm working on ECG classification using MATLAB, and my data is stored in CSV format with 13 columns (time + 12 leads). I'm interested in extracting PQRST segments using the segmentation method described in this MATLAB code: ECG Segmentation and Filtering.
I have a few questions regarding preprocessing:
- Should I apply low-pass filters to all recordings to enhance signal quality?
- I intend to retain various types of noise in the data to ensure model robustness. What are your recommendations on managing noise while preserving the integrity of PQRST segments?
Additionally, I'm curious about segmentation approach:
- Should I perform segmentation separately for each of the 12 leads, or should I merge them before segmentation? What would be the pros and cons of each approach?
Here an example of an ECG data:

Any insights or suggestions on adapting the segmentation method and handling data preprocessing would be greatly appreciated. Thank you!
1 Comment
adi
on 16 Mar 2025
can you send me the csv fie
Accepted Answer
More Answers (3)
Umar
on 30 Jun 2024
1 vote
Hi Rawaa,
For ECG data preprocessing, try to apply low-pass filters which will enhance signal quality by removing high-frequency noise. However, retaining some noise types can improve model robustness. To manage noise while preserving PQRST integrity, consider using adaptive filters or wavelet denoising techniques.
Regarding segmentation, you can choose to segment each of the 12 leads separately or merge them before segmentation. Segmentation per lead allows for lead-specific analysis but may require more computational resources. Merging leads simplifies processing but may overlook lead-specific characteristics. Experiment with both approaches to determine the best fit for your dataset and analysis goals.
Remember to validate the segmentation method's effectiveness by comparing results with ground truth annotations.
Hope this will help resolve your problem.
Umar
on 5 Jul 2024
0 votes
Hi Rawaa,
I have already read the technical articles for both of them, so let me delve into the specifics of the bior3.1 and sym4 wavelet families to help you make an informed decision.
bior3.1 Wavelet Family
The bior3.1 wavelet belongs to the Biorthogonal wavelet family. Biorthogonal wavelets have the advantage of providing a good compromise between time and frequency localization. The bior3.1 wavelet has three vanishing moments in the wavelet function and one vanishing moment in the scaling function. This property makes it suitable for applications where preserving sharp transitions in the signal is essential. The bior3.1 wavelet is known for its ability to capture abrupt changes in the signal efficiently.
sym4 Wavelet Family
On the other hand, the sym4 wavelet is part of the Symlet wavelet family. Symlet wavelets are designed to be symmetric with a compact support, making them suitable for denoising applications and signal compression. The sym4 wavelet, in particular, has four vanishing moments in the wavelet function, allowing it to represent polynomial signals accurately. It is known for its effectiveness in denoising applications where preserving signal smoothness is crucial.
Choosing the Best Wavelet Family
To determine the best wavelet family between bior3.1 and sym4, you need to consider the specific characteristics of your signal and the requirements of your signal processing task. If your signal contains sharp transitions or discontinuities that need to be preserved, the bior3.1 wavelet may be more suitable due to its ability to capture abrupt changes effectively. On the other hand, if your signal is smooth and you are focusing on denoising or compression tasks, the sym4 wavelet from the Symlet family might be a better choice.
Again, the final decision needs to be made by you. I still wish you good luck with this project. Hope, you get A plus.
1 Comment
rawaa mejri
on 30 Jul 2024
Umar
on 30 Jul 2024
0 votes
Hi @rawaa mejri,
What makes you think bior3.9 with adaptive is the best one ? Provide your analysis with brief answer.
4 Comments
rawaa mejri
on 31 Jul 2024
Umar
on 31 Jul 2024
@ rawaa mejri, this is what I was expecting from you. You did it. At mathworks, my goal is to make sure when students are having issues with problems, they should be capable of solving problems on their own by getting clues from us, and more research, experimenting and making mistakes you will do, the more you will learn. However, if you still have any questions for me, please let me know, I will be more happy to help.
rawaa mejri
on 31 Jul 2024
Umar
on 31 Jul 2024
No problem @ rawaa mejri, glad to help out. If you need further assistance for next step, please don’t hesitate to ask for help.
Categories
Find more on Signal Analysis in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!






