# Switched Control of Motor Assistance and Functional Electrical Stimulation for Bieps Curls +
## Materials and Methods
### Stability Analysis  
The following analysis proves the stability of the FES and motor controllers designed in the previous subsection, such that they can be safely implemented during the biceps curls experiments described in the next subsection. Let \(V_{L}:\,\mathbb{R}^{2}\,\rightarrow\mathbb{R}\) be a continuously differentiable, positive definite, common Lyapunov function candidate defined as  
\[V_{L}\left(t\right)\triangleq\frac{1}{2}\epsilon_{1}^{2}+\frac{1}{2}Me_{2}^{2}, \tag{15}\]  
which satisfies the following inequalities:  
\[\lambda_{A}||z||^{2}\leq V_{L}\leq\lambda_{B}||z||^{2}, \tag{16}\]  
where \(\lambda_{A},\,\lambda_{B}\,\in\,\mathbb{R}_{>0}\) are known positive constants defined as \(\lambda_{A}\triangleq\min\left(\frac{1}{2},\,\frac{c_{m}}{2}\right)\) and \(\lambda_{B}\triangleq\max\left(\frac{1}{2},\,\frac{c_{M}}{2}\right),\) where \(c_{m}\) and \(c_{M}\) were introduced in Property 2. **Theorem 1**. : _When the desired trajectory indicates flexion (i.e., \(\dot{q}_{d}>0\)) and the motor is inactivated, \(\delta=0,\)\(B_{\sigma}>0,\) and the FES controller in (12) ensures exponential tracking such that_  
\[\parallel z\left(t\right)\parallel\leq\sqrt{\frac{\lambda_{B}}{\lambda_{A}}} \parallel z\left(t_{n,j}^{1}\right)\parallel\exp\left[-\frac{1}{2}\lambda_{2 }\left(t-t_{n,j}^{1}\right)\right], \tag{17}\]  
\(\forall t\,\in\,[t_{n,\,j}^{1},\,t_{n,\,j}^{2}),\) where \(t_{n,\,j}^{1},\,t_{n,\,j}^{2}\,\in\,\mathbb{R}_{>0}\) are defined as \(t_{n,\,j}^{1}\triangleq\max\left(T_{flex,\,n},\,T_{n,\,j}^{l}\right)\) and \(t_{n,\,j}^{2}\triangleq\min\left(T_{ext,\,n},\,T_{n,\,j+1}^{u}\right),\) respectively, and \(\lambda_{2}\in\mathbb{R}_{>0}\) is defined as  
\[\lambda_{2}\triangleq\frac{1}{\lambda_{B}}\min\left(\alpha,\,k_{1}\right), \tag{18}\]  
provided the following gain conditions are satisfied:  
\[k_{2}\geq c_{1},\,\,k_{3}\geq c_{2},\,\,k_{4}\geq c_{3}, \tag{19}\]  
where \(c_{1},\,c_{2},\,c_{3}\) are introduced in (11). Proof. : Because of the signum function in the closed-loop error system in (14), the time derivative of (15) exists almost everywhere (a.e. ), and \(\dot{V}_{L}\,\overset{a.e. }{\in}\,\,\dot{\bar{V}}_{L}\)[26] such that  
\[\dot{\bar{V}}_{L}\subseteq e_{1}\left(e_{2}-\alpha e_{1}\right)+\left(\frac{1} {2}M\dot{e}_{2}^{2}-V\right)e_{2}^{2}+e_{2}X-e_{2}e_{1}-K\left[B_{\sigma}c_{ \sigma}^{-1}e_{2}\left(k_{1}e_{2}+\left(k_{2}+k_{3}\parallel z\parallel+k_{4} \parallel z\parallel^{2}\right)\text{sgn}\left(e_{2}\right)\right)\right], \tag{20}\]  
where \(K\left[\cdot\right]\) is defined in [27] and \(K\left[\text{sgn}\left(\cdot\right)\right]=\text{SGN}\left(\cdot\right),\) such that \(\text{SGN}(\cdot)=\{1\}\) if \(\left(\cdot\right)>0,\)\(\left[-1,\,1\right]\) if \(\left(\cdot\right)=0,\) and \(\{-1\}\) if \(\left(\cdot\right)<0.\) Upper bounding (20) using Property 7 and (11) results in  
\[\dot{\bar{V}}_{L}\overset{a.e.}{\leq}-\alpha e_{1}^{2}-k_{1}e_{2}^{2}-\left(k_{ 2}-c_{1}\right)\left|e_{2}\right|-\left(k_{3}-c_{2}\right)\left|e_{2}\right| \parallel z\parallel-\left(k_{4}-c_{3}\right)\left|e_{2}\right|\parallel z \parallel^{2}. \tag{21}\]Since \(\dot{V}_{L}\ \stackrel{{ a.e. }}{{\in}}\ \dot{\bar{V}}_{L}\), further upper bounding of the Lyapunov derivative, provided the gain conditions in (19) are satisfied, results in  
\[\dot{V}_{L}\ \stackrel{{ a.e.}}{{\leq}}-\lambda_{2}V_{L}\left(t \right), \tag{22}\]  
where \(\lambda_{2}\) is defined in (18). Using (16), the result in (17) can be obtained.