# Adaptive Prosthetic Trajectory Estimation Based on Key Points Constraints
## 3 Adaptive Kinematic Estimation Method
### Invariant Basis Function Estimation Considering Key Points Constraints  
The basis function is defined as the gait trajectory with \(\varphi\) under a speed of 1 m/s and a slope of 0, expressed as follows:  
\[q^{0}=q(\varphi,1,0)=b(\varphi) \tag{11}\]  
The invariant basis function is fitted by Fourier series, whose expression is as follows:  
\[b(\varphi)=a_{0}+\sum_{i=1}^{F}(a_{i}\sin(i\varphi)+b_{i}\cos(i\varphi)) \tag{12}\]  
where the coefficient matrix \([a_{0},a_{1},\cdots,a_{F},b_{1},b_{2},\cdots,b_{F}]^{T}\in\mathbb{R}^{(2F+1) \times 1}\) is the order of the Fourier series. Generally, the larger the \(F\) is, the better the fitting effect of the specified points is, but it is more likely to cause overfitting.  
The first goal of fitting is to fit all data points; on the other hand, the accuracy of fitting key points should be ensured as much as possible. Therefore, the convex optimization  
In this study, a radial basis function (RBF) neural network was used to fit the task function. RBF is a kind of feedback neural network with good performance, which is suitable for solving nonlinear problems. The basic idea is to transform the input vector by introducing the radial basis function as the activation function of the hidden layer neuron, and transform the low-dimensional input data into a high-dimensional space, so that the neural network can better approximate the nonlinear function. The input vector is \(X=\left[x_{1},x_{2},\cdots,x_{n}\right]^{T}\), and the radial basis vector is \(H=\left[h_{1},h_{2},\cdots,h_{m}\right]^{T}\), where \(h_{j}\) is the following Gaussian basis function:  
\[h_{j}=\exp\left(-\frac{\parallel X-c_{j}\parallel}{2b_{j}^{2}},j=1,2,\cdots,m\right) \tag{14}\]  
where \(c_{j}\) is the center vector of the \(j\)th node of the network. When the base width vector of the network is set to \(B=\left[b_{1},b_{2},\cdots,b_{m}\right]^{T}\), \(b_{j}\) is the base width function of node \(j\). The weight vector is \(W=\left[\omega_{1},\omega_{2},\cdots,\omega_{m}\right]^{T}\). The resulting output is as follows:  
\[y_{m}(t)=\omega_{1}h_{1}+\omega_{2}h_{2}+\cdots+\omega_{m}h_{m} \tag{15}\]  
According to the gradient descent method, the iterative algorithm of the output weight, node center, and node base width parameters are as follows:  
\[\omega_{j}(t)=\omega_{j}(t-1)+\eta(y(t)-y_{m}(t))h_{j}+\alpha\big{(}\omega_{j} (t-1)-\omega_{j}(t-2)\big{)} \tag{16}\]  
\[\Delta b_{j}=(y(t)-y_{m}(t))\omega_{j}h_{j}\frac{\parallel X-C_{j}\parallel^{ 2}}{b_{j}^{3}} \tag{17}\]  
\[b_{j}(t)=b_{j}(t-1)+\eta\Delta b_{j}+\alpha\big{(}b_{j}(t-1)-b_{j}(t-2)\big{)} \tag{18}\]  
\[\Delta c_{ji}=(y(t)-y_{m}(t))\omega_{j}\frac{x_{i}-c_{ji}}{2b_{j}^{2}} \tag{19}\]  
\[c_{ji}(t)=c_{ji}(t-1)+\eta\Delta c_{ji}+\alpha\big{(}c_{ji}(t-1)-c_{ji}(t-2) \big{)} \tag{20}\]  
where \(\eta\) is the learning rate and \(\alpha\) is the momentum factor.  
Figure 4: Ankle joint task function under 0.8 m/s. The value changes relative to slope in each phase variable dimension and presents a nonlinear change trend. (**a**) represents how the task function changes with slope and phase variable. (**b**) visually illustrates the regular change of the task function with slope.