## 2 Methods
### Signal Processing and Algorithm Development
#### 2.2.2 Algorithm Description  
For the purposes of discussion of how torque-time data were processed, a few terms must be defined, in terms of the stimulation delivered during experiments. Application of these terms in the context of torque-time waveforms is also depicted (Figure 3). Let:  
A **partition** represent the five pulse trains delivered at a given duty cycle (one ramp pulse train, three pulse trains, and one partial pulse thereafter). A **block** represent the total number of partitions where no duty cycle is repeated (i.e., seven partitions in this experiment). The terms **partition** and **block** can refer to either (a) the electrical stimulation, or (b) the resultant torque waveform generated due to the stimulation. The block-partition notation used to describe pulse trains is presented in Figure 3. Three blocks of stimulation were delivered, each with seven partitions (one for each duty cycle). Block 1 also contained a warm-up partition. _BmPn_ notation signifies block \(m\) partition \(n\). B1 PW was the warm-up partition in block 1. Therefore, in total, there were \(3\times 7+1=22\) partitions of stimulation delivered. The goal of algorithm development was, thus, to separate all duty cycles from torque-time data series and align all three repetitions from a given experiment (i.e., align duty cycle 1 from blocks 1, 2, 3, and then duty cycle 2, etc.). This was achieved by designing custom-made algorithms comprised of: a) large main pieces of code for \"main\" processing  
Figure 3: Stimulation delivered in randomized order. Figure 2: Summary of data processing. (modules); b) associated functions to assist these modules in achieving their tasks (functions). A summary of all modules and functions is presented in Table 6 Algorithms were run and data processed as discussed below (next section). The modules and functions described in Table 6 may be summarized and connected by a series of control flow diagrams. These diagrams summarize pertinent features of each module and function so they may be understood by any researchers who wish to develop similar algorithms. **dataloader**--Initial Loading of Data  
Upon acquisition of data from the Biodex, there are characteristically three datasets: samples (time), torque, and angle of the machine. In this experiment, the sampling rate of the Biodex was set at 100 Hz, so time samples were obtained every 1/100 of a second. Data were initially acquired from the Biodex in the.LVM format but saved as.XLSX. The dataloader module (Figure 4) accesses these three datasets and imports them into MATLAB, based on the user-specified file number. It then inverts the torque, giving it a positive sign for ease of analysis thereafter. **PeakFinder--**Location of Peaks  
This module (Figure 5) produces a form of the torque-time data in the region of interest (ROI), selected by the user manually. This ROI is the torque-time waveform with noise at the beginning and the end removed. It then converts the \(x\)-axis from samples (1/100 s) to time (s) and shifts the \(y\)-axis such that the torque of gravity is accounted for (baseline correction). In this code, the baseline correction value was taken as an approximate value of 10 Nm on the basis of prior calculations, which are the focus of other work. The initial peak detection performed by the code is based on the built-in findpeaks function in MATLAB. This function requests a value that will define where the built-in function searches for a peak. In this code, it was referred to as the Kvalue (Figure 5). This was obtained by a trial-and-error approach. A similar \"guessing\" approach has also been used for example to determine vertical prominence value, which was adopted by [PERSON] and colleagues [12]. A range of Kvalues were trialled by changing the Kvalue in the preliminary code and seeing the resultant peak number PN1. This was then compared to the expected peak number, EPN, which was calculated by computing how many peaks were to be expected from the stimulation.