Skip to main content
. 2023 Jan 5;16:1064313. doi: 10.3389/fnbot.2022.1064313

Algorithm 2.

Gait segmentation.

1:  function SEGMENT(fz, filtered)
2:   filtered(i) = filtered(i+1) for i = 1:lag−1
3:   fz = 1 if fz>1 and fz=0 if fz < 0
4:   if fz == mean(filtered) then
5:   pext = 0 // swing phase
6:   filtered(lag) = fz
7:   else
8:   if ft>Fth then
9:   pext = 1 // stance phase
10:   else if ft≥ mean(filtered) then
11:   // increasing vertical load
12:   pext = 1 // stance phase
13:   else
14:   pext = 0 // swing phase
15:   end if
16:   filtered(lag) = influence·fz+(1−influencefiltered(lag−1);
17:   end if
18:   return pext, filtered
19:  end function