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 the IBI
if it is not yet available
18 %> @param BVPSignal: the BVP signal
19 %> @retval BVPSignal: the @b BVP signal containing the computed IBI signal
21 %> @author Copyright Guillaume Chanel 2015
24 %Compute the signal
if it has not been already computed
27 %Get information on the BVP signal
31 %Reshape BVP
if needed
32 if size(BVP,1)<size(BVP,2)
36 %Remove trend for better peak detection
37 trend = smooth(BVP,samprate); % TODO: refine the window size ? This size seem to wok well thanks to Mohammad
41 [~, ~, ~, listePeak] =
PLETtoBPM(-BVP, samprate); %Negation of signal to find the systolic upstroke
42 [~, IBI, ~, listePeak] =
correctBPM(listePeak, samprate);
44 if(length(listePeak) < 2)
45 warning(['A least 2 peaks are needed to compute IBI but ' num2str(length(listePeak)) ' were found: result will be NaN'])
50 %Attribute the computed signal to IBI to check if range is correct
51 % This is done now because this can cause problems in the resampling
55 %Resample the signal with the one requested for IBI
57 IBI =
interpIBI(listePeak/samprate,IBI_samprate,listePeak(end)/samprate)';
59 %Attribute the computed signal to IBI