## 4 Signal Processing Algorithm for Classification of 17 Motions
### Feature Extraction Based on Spectral Analysis  
After removing the DC offset, PSDs are calculated by applying FFT to the pEMG signals. In this step, a 32-sample hamming window with 75% overlap is used when performing FFT. Next, feature points for each motion are extracted from the PSDs to construct a feature vector. In this study, spectral magnitudes at 6 frequencies are used as features. Considering the fact that the Nyquist frequency is 100 Hz (sampling frequency of the equipment is 200 Hz) and the frequency resolution is 6.25 Hz, one frequency is chosen from each of the following frequency range: 10-20 Hz, 20-30 Hz, 30-40 Hz,  
Figure 5: An example of raw EMG (rEMG) signal during the execution of 17 motions. The channels are layout in ascending order starting from the top.  
60-70 Hz, 70-80 Hz, 80-90 Hz. The 40-50 Hz and 50-60 Hz frequency ranges are not considered because they contain the frequencies of the power-line interferences. Based on the selection results, the elements of the feature vectors are made up of log-transformed spectral magnitude at 18.75 Hz, 25 Hz, 31.25 Hz, 68.75 Hz, 75 Hz, 81.25 Hz of each channel. Thus, the feature vector of \(j\)th motion is a 36-dimensional vector and can be expressed as  
\[\boldsymbol{f}^{j}=[\begin{array}{cccccc}f_{1}^{j}&\cdots&f_{i}^{j}&\cdots&f_ {36}^{j}\end{array}]\in\Re^{1\times 36}, \tag{1}\]  
where \(f_{i}^{j}\) is the \(i\)th element of the feature vector of \(j\)th motion. Figures 6 and 7 shows an example of normalized PSDs of all 17 motions derived from pEMG signals on channel 2 and channel 5.  
Figure 6: An example of PSDs prior to log transform of 17 motions shown as a function of time. The PSDs are derived from pEMG signals on channel 2. In order from the top, PSDs at 18.75 Hz, 25 Hz, 31.25 Hz, 68.75 Hz, 75 Hz, 81.25 Hz. Note that the PSDs are normalized for better visualization.  
Figure 7: An example of PSDs prior to log transform of 17 motions shown as a function of time. The PSDs are derived from pEMG signals on channel 5. In order from the top, PSDs at 18.75 Hz, 25 Hz, 31.25 Hz, 68.75 Hz, 75 Hz, 81.25 Hz. Note that the PSDs are normalized for better visualization.  
Let \(m\) be the number of sets of training data used in the training process, with each set containing EMG signals of all 17 motions (1 trial for each motion). Then, from a single set of training data, a matrix consisting of feature vectors of each motion can be derived and defined as  
\[\mathbf{F}_{n}=\left[\begin{array}{c}\
ot{H}\\ \vdots\\ \
ot{H}^{7}\end{array}\right]\in\Re^{17\times 36},\ \ \ n\in\{1,2,\,\cdots,\,m\}, \tag{2}\]  
Furthermore, using (2), a feature matrix containing all feature vectors derived from \(m\) sets of training data can be expressed as  
\[\mathbf{F} =\left[\begin{array}{c}\mathbf{F}_{1}\\ \vdots\\ \mathbf{F}_{n}\\ \vdots\\ \mathbf{F}_{m}\end{array}\right]\in\Re^{17m\times 36}, \tag{3}\] \[=\left[\begin{array}{cccc}\mathbf{f}_{1}&\cdots&\mathbf{f}_{i}&\cdots& \mathbf{f}_{36}\end{array}\right]\]  
where \(\mathbf{f}_{i}\) is a \(17m\) dimension column vector. Next, the feature matrix (3) is normalized by  
\[\widetilde{\mathbf{F}}=\left[\begin{array}{cccc}\frac{\mathbf{f}_{1}}{\min(\mathbf{f}_{ 1})}&\cdots&\frac{\mathbf{f}_{i}}{\min(\mathbf{f}_{i})}&\cdots&\frac{\mathbf{f}_{36}}{ \min(\mathbf{f}_{36})}\end{array}\right]\in\Re^{17m\times 36}, \tag{4}\]  
and use as the input signal to train the ANN classifier. In the online classification stage, the feature vector at \(k\)th sampling instance are given by  
\[\mathbf{\hat{f}}(k)=\left[\begin{array}{cccc}\frac{\hat{\mathbf{f}}_{i}(k)}{\min( \mathbf{f}_{1})}&\cdots&\frac{\hat{\mathbf{f}}_{i}(k)}{\min(\mathbf{f}_{i})}&\cdots&\frac{ \hat{\mathbf{f}}_{36}(k)}{\min(\mathbf{f}_{36})}\end{array}\right]\in\Re^{1\times 36}. \tag{5}\]  
Note that \(\min(\mathbf{f}_{i})\) should be determined beforehand from \(m\) training data sets.