Using the findpeaks function with threshold
Afficher commentaires plus anciens
ECG=load('ECG.csv');
f_s=350;
N=length(ECG);
t=[0:N-1]/f_s;
[pks,locs] = findpeaks(ECG,'MinPeakHeight',threshold)
plot(t,ECG,t(locs),pks,'.')
I want to find the peaks of my ECG trace using findpeaks but I am unsure of how to use the function. I have tried using this code and changing threshold to a value. Is there a way of having it inputted by the user?
I would also like these peaks to be stored as a 1D vector. I was wondering if anyone could help out with the code!
Kind regards
1 commentaire
Meg Noah
le 12 Jan 2020
The very same question was recently asked:
Réponses (1)
Devineni Aslesha
le 14 Jan 2020
Modifié(e) : Devineni Aslesha
le 14 Jan 2020
The threshold value can be inputted by the user as shown below.
prompt = 'What is the threshold value? ';
threshold = input(prompt);
The syntax ‘[pks,locs] = findpeaks(ECG,'MinPeakHeight',threshold)’ stores the peaks above threshold value as a 1D vector in the variable ‘pks’.
For more information, refer the following link:
Catégories
En savoir plus sur Descriptive Statistics dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!