1 %This file is part of TEAP.
3 %TEAP is free software: you can redistribute it and/or modify
4 %it under the terms of the GNU General Public License as published by
5 %the Free Software Foundation, either version 3 of the License, or
6 %(at your option) any later version.
8 %TEAP is distributed in the hope that it will be useful,
9 %but WITHOUT ANY WARRANTY; without even the implied warranty of
10 %MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 %GNU General Public License
for more details.
13 %You should have received a copy of the GNU General Public License
14 %along with TEAP. If not, see <http://www.gnu.org/licenses/>.
17 %> @brief Computes BPM and IBI from a list of pics
18 %> @b Author: Guillaume Chanel
20 %> @param listePic list of samples containing a pic
21 %> @param fe sampling frequency
23 %> @retval bpm beat per minuts
24 %> @retval delta_t Interbeat intervals (IBI)
25 %> @retval sample (possibly 1/2 samples) at which the IBI is computed,
this is
26 %> in fact the average of the start and end beats samples (i.e. the HR
27 %> considered to lies inbetween the two beats).
28 %> @author Guillaume Chanel
29 function [bpm delta_t t] =
PICtoBPM(listePic, fe)
34 for(j=2:length(listePic))
35 deltaSamp(j-1) = listePic(j)-listePic(j-1);
36 if(deltaSamp(j-1) <= 0)
37 error(
'L''ecart entre deux pic doit etre de 1 minimum');
39 bpm(j-1) = 60/(deltaSamp(j-1)*(1/fe));
40 t(j-1) = mean([listePic(j-1) listePic(j)]);
42 delta_t = deltaSamp / fe;