# Design of a Morphing Aircraft Based on Model Predictive Control
## 3 Controller Design  
### Model Predictive Controller Design  
Model predictive control (MPC) predicts the system state and computes control commands in a receding horizon optimization manner while satisfying state constraints [25; 26; 27]. At each sampling instant, MPC solves a finite-horizon optimization problem to compute the optimal control sequence. For discrete-time systems, MPC reformulates Equation (3) into its discrete form, resulting in the following state-space equations: For discrete-time systems, Equation (11) is rewritten in discrete form, yielding the following state-space equation:  
\[\Delta x(k+1)=\mathbf{A}(\xi_{b})\Delta\mathbf{x}(k)+\mathbf{B}\Delta\mathbf{u}(k) \tag{12}\]  
The values of \(\xi_{b}\) in the discrete system come from \([0,0.1,0.2,0.3,0.4,0.5,0.6,0.7,0.8,0.9,1]\). Consequently, in the discrete system, the state matrix \(\mathbf{A}(\xi_{b})\) can be regarded as a constant matrix. The control vector \(\Delta\mathbf{u}(k)\) is represented as \(\mathbf{u}(k)\), while the state vector \(\Delta\mathbf{x}(k)\) is represented as \(\mathbf{x}(k)\), for simplicity's sake. The equation above can also be expressed as follows:  
\[\mathbf{x}(k+1)=\mathbf{A}\mathbf{x}(k)+\mathbf{B}\mathbf{u}(k) \tag{13}\]  
Transforming the tracking problem into a stable control problem based on the error signal, we consider the initial time step as \(k\) and the prediction horizon as \(N_{p}\). The quadratic performance index is defined as follows:  
\[J=\frac{1}{2}\mathbf{x}_{[N_{p}]}^{\mathrm{T}}\mathbf{S}\mathbf{x}_{[N_{p}]}+\frac{1}{2} \sum_{k=0}^{N_{p}-1}\left[\mathbf{x}_{[k]}^{\mathrm{T}}\mathbf{Q}\mathbf{x}_{[k]}+\mathbf{u}_ {[k]}^{\mathrm{T}}\mathbf{R}\mathbf{u}_{[k]}\right] \tag{14}\]  
where \(\mathbf{S}\), \(\mathbf{Q}\), and \(\mathbf{R}\) represent the weight matrices for the terminal cost, running cost, and control effort cost, respectively. \(N_{p}\) represents the prediction horizon. At time step \(k\), the system predicts the state variable evolution within the horizon (from \(k\) to \(k+N_{p}\)), where the predicted state at time step \(k+1\) is given by the following:  
\[\mathbf{x}_{[k+1|k]}=\mathbf{A}\mathbf{x}_{[k|k]}+\mathbf{B}\mathbf{u}_{[k|k]} \tag{15}\]  
The predicted state variable at time step \(k+2\) is as follows:  
\[\mathbf{x}_{[k+2|k]}=\mathbf{A}\mathbf{x}_{[k+1|k]}+\mathbf{B}\mathbf{u}_{[k+1|k]} \tag{16}\]  
Substituting Equation (15) into Equation (16) yields the following:  
\[\mathbf{x}_{[k+2|k]}=\mathbf{A}(\mathbf{A}\mathbf{x}_{[k|k]}+\mathbf{B}\mathbf{u}_{[k|k]})+\mathbf{B}\mathbf{ u}_{[k+1|k]}=\mathbf{A}^{2}\mathbf{x}_{[k|k]}+\mathbf{A}\mathbf{B}\mathbf{u}_{[k|k]}+\mathbf{B}\mathbf{u}_{[k +1|k]} \tag{17}\]  
By analogy, the state at time \(k+N_{p}\) can be obtained. \[\mathbf{x}_{[k+N_{p}|k]}=\mathbf{A}^{N_{p}}\mathbf{x}_{[k|k]}+\mathbf{A}^{N_{p}-1}\mathbf{B}\mathbf{u} _{[k|k]}+\cdots+\mathbf{A}\mathbf{B}\mathbf{u}_{[k+N_{p}-2|k]}+\mathbf{B}\mathbf{u}_{[k+N_{p}-1|k]} \tag{18}\]  
From the above equation, the performance index \(J\) is related to the initial state \(\mathbf{x}_{[k|k]}\) and the input sequence within the prediction horizon. To simplify the system analysis, define \(\mathbf{X}_{[k]}\) and \(\mathbf{U}_{[k]}\) as follows:  
\[\mathbf{X}_{[k]}\triangleq\left[ \begin{array}{c}\mathbf{x}_{[k+1|k]}\\ \mathbf{x}_{[k+2|k]}\\ \vdots\\ \mathbf{x}_{[k+N_{p}|k]}\end{array} \right]_{(nN_{p})\times 1},\mathbf{U}_{[k]} \triangleq\left[ \begin{array}{c}\mathbf{u}_{[k|k]}\\ \mathbf{u}_{[k+1|k]}\\ \vdots\\ \mathbf{u}_{[k+N_{p}-1|k]}\end{array} \right]_{(pN_{p})\times 1}\]  
where \(\mathbf{X}_{[k]}\) is an \((nN_{p})\times 1\) dimensional vector that contains all predicted state variables within the prediction horizon at time \(k\). Similarly, \(\mathbf{U}_{[k]}\) is an \((pN_{p})\times 1\) dimensional vector representing the control input sequence computed at time \(k\). Thus, a compact form can be obtained as follows:  
\[\mathbf{X}_{[k]}=\mathbf{\Phi}\mathbf{x}_{[k|k]}+\mathbf{\Gamma}\mathbf{U}_{[k]} \tag{19}\]where  
\[\mathbf{\Phi}=\left[