close all clear clc % PPG generator is tested for simulating sinus rhythm, atrial fibrillation, premature beats, bradycardia and tachycardia episodes. pulseType = 1; % 1 - Type 1, 2 - Type 2, 3 - Type 3, 4 - Type 3 bis, 5 - Type 4 Fd = 500; % PPG sampling frequency % Test RR interval series in seconds * Fd = samples RR = [1 1 1 1 1 1 1 0.4 1.2 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1]*Fd; % ---PPG generator--- [PPGmodel, PPGpeakIdx, PPGpeakVal] = gen_PPG(RR, pulseType, Fd); % PPGmodel - generated PPG signal % PPGpeakIdx - sample number when pulse peak occurs % PPGpeakVal - PPG pulse peak values figure; plot(PPGmodel); hold on; plot(PPGpeakIdx, PPGpeakVal, 'ro'); hold off;