Skip to main content
. 2023 Feb 16;23(4):2220. doi: 10.3390/s23042220
Algorithm 1 ECG-Guided PPG Signal-Quality Assessment.
  •   1:

    procedure  Identifying R and T Waves in ECG Signals

  •   2:

        ECGR wavesR waves positions

  •   3:

        R waves positionsT waves positions

  •   4:

    procedure  Determining the Locations of PPG Pulse Onsets

  •   5:

        PPG onsets = min(PPG(R waves positions:T waves positions))

  •   6:

        PPG onsetsPPG onsets positions

  •   7:

    procedure  Assessing the Variability in PPG Pulse Amplitudes

  •   8:

        step 1: PPG Envelope Estimation

  •   9:

        for i = 1: length(PPG onsets positions) - 1 do

  • 10:

            ePPG(i) = max(PPG(PPG onsets positions(i): PPG onsets positions(i+1)))

  • 11:

        end

  • 12:

        step 2: Absolute Second Derivative of PPG Envelope Estimation

  • 13:

        for i = 1: length(ePPG) - 2 do

  • 14:

            |ePPG(i)|=|ePPG(i+2)2·ePPG(i+1)+ePPG(i)|

  • 15:

        end

  • 16:

        step 3: Absolute Second Derivative of PPG Envelope Smoothing

  • 17:

        order=5

  • 18:

        |ePPG(i)|s = median filter(|ePPG(i)|, order)

  • 19:

        step 4: Absolute Second Derivative of PPG Envelope Offsetting

  • 20:

        k-subtraction constant; N=length(|ePPG|s)

  • 21:

        |ePPG|center=|ePPG|s(round(0.25·N):round(0.75·N))

  • 22:

        |ePPG(i)|o=|ePPG(i)|sk·mean(|ePPG|center)

  • 23:

    procedure  Identifying Low-Quality PPG Pulse Waves

  • 24:

        thresholds: θ1 and θ2

  • 25:

        if (|ePPG|o<θ1)&(ePPG>θ2) then

  • 26:

        SQI=1-High Quality

  • 27:

        otherwise

  • 28:

        SQI=0-Low Quality

  • 29:

        end