# Advanced Construction of the Dynamic Matrix in Numerically Efficient Fuzzy MPC Algorithms
## 2 Efficient Fuzzy MPC Algorithms with the Advanced Construction of the Dynamic Matrix
### Generation of the Dynamic Matrix
#### 2.2.3 Advanced Dynamic Matrix Generation  
In the first time step from the prediction horizon, the fuzzy model (generating outputs for the \((k+1)\)st time step) has the following form:Rule \(f\):  
\[\text{if }y_{k}^{j_{y}}\text{ is }B_{1}^{f,j_{y}}\text{ and }y_{k-1}^{j_{y}} \text{ is }B_{2}^{f,j_{y}}\text{ and }\dots\text{ and }y_{k-n+1}^{j_{y}}\text{ is }B_{n}^{f,j_{y}}\text{ and }\] \[u_{k}^{j_{u}}\text{ is }C_{1}^{f,j_{u}}\text{ and }u_{k-1}^{j_{u}} \text{ is }C_{2}^{f,j_{u}}\text{ and }\dots\text{ and }u_{k-m+1}^{j_{u}}\text{ is }C_{m}^{f,j_{u}}\] \[\text{ then }\widehat{y}_{k+1}^{j,f}=\sum_{m=1}^{n_{u}}\sum_{n=1}^{p_{ d}-1}a_{m}^{j,m,f}\dots\Delta u_{k-n+1}^{m}+a_{p_{d}}^{j,m,f}\cdot u_{k-p_{d}+1}^{m} \text{,}\]  
However, \(u_{k}^{j_{u}}\) are not known yet, but the approach used in the free response generation can be applied here, i.e., the appropriate element of the future trajectory of the control signals can be used, namely: \(u_{k|k-1}^{j_{u}}\). Therefore, the premises used to obtain the firing strengths of the fuzzy rules will be as follows:  
Rule \[f\] (27) \[\text{if }y_{k}^{j_{y}}\text{ is }B_{1}^{f,j_{y}}\text{ and }y_{k-1}^{j_{y}} \text{ is }B_{2}^{f,j_{y}}\text{ and }\dots\text{ and }y_{k-n+1}^{j_{u}}\text{ is }B_{n}^{f,j_{y}}\text{ and }\] \[u_{k|k-1}^{j_{u}}\text{ is }C_{1}^{f,j_{u}}\text{ and }u_{k-1}^{j_{u}} \text{ is }C_{2}^{f,j_{u}}\text{ and }\dots\text{ and }u_{k-m+1}^{j_{u}}\text{ is }C_{m}^{f,j_{u}}\]  
As a result, the normalized firing strengths of the fuzzy rules \(\widehat{w}_{k+1|k}^{f}\) will be obtained for the \((k+1)^{\text{st}}\) time step from the prediction horizon (calculated at the \(k\)th sampling instant, using the fuzzy reasoning); the appropriate elements of the dynamic matrix will be then calculated using the formula:  
\[\widehat{a}_{n,k+1}^{j,m}=\sum_{f=1}^{l}\widehat{w}_{k+1|k}^{f}\cdot a_{n}^{j, m,f}\text{.} \tag{28}\]  
In the second time step from the prediction horizon, the fuzzy model has the following form:  
Rule \[f\] (29) \[\text{if }y_{k+1}^{j_{y}}\text{ is }B_{1}^{f,j_{y}}\text{ and }y_{k}^{j_{y}} \text{ is }B_{2}^{f,j_{y}}\text{ and }\dots\text{ and }y_{k-n+2}^{j_{y}}\text{ is }B_{n}^{f,j_{y}}\text{ and }\] \[u_{k+1}^{j_{u}}\text{ is }C_{1}^{f,j_{u}}\text{ and }u_{k}^{j_{u}} \text{ is }C_{2}^{f,j_{u}}\text{ and }\dots\text{ and }u_{k-m+2}^{j_{u}}\text{ is }C_{m}^{f,j_{u}}\] \[u_{k}^{j_{u}}\text{ is }C_{1}^{f,j_{u}}\text{ and }u_{k-1}^{j_{u}} \text{ is }C_{2}^{f,j_{u}}\text{ and }\dots\text{ and }u_{k-m+1}^{j_{u}}\text{ is }C_{m}^{f,j_{u}}\]0  
This time, however, not only \(u_{k}^{j_{u}}\) are not known yet, but also \(u_{k+1}^{j_{u}}\) and \(y_{k+1}^{j_{y}}\). One can use the approach from the previous step, i.e., instead of \(u_{k+1}^{j_{u}}\), \(u_{k+1|k-1}^{j_{u}}\) is used. The other problem is that also the values \(y_{k+1}^{j_{y}}\) are not known yet. However, one can use the appropriate elements of the free response here, namely \(\widehat{y}_{k+1|k}^{j_{y}}\). Therefore, the premises used to obtain the firing strengths in the next \((k+2)\)nd time step from the prediction horizon will have the following form:  
Rule \[u_{k}^{j_{u}}\text{ is }C_{1}^{f,j_{u}}\text{ and }u_{k-1}^{j_{u}} \text{ is }C_{2}^{f,j_{u}}\text{ and }\dots\text{ and }u_{k-m+1}^{j_{u}}\text{ is }C_{m}^{f,j_{u}}\]1 (30) \[u_{k}^{j_{u}}\text{ is }C_{1}^{f,j_{u}}\text{ and }u_{k-1}^{j_{u}} \text{ is }C_{2}^{f,j_{u}}\text{ and }\dots\text{ and }u_{k-m+1}^{j_{u}}\text{ is }C_{m}^{f,j_{u}}\]2 \[u_{k}^{j_{u}}\text{ is }C_{1}^{f,j_{u}}\text{ and }u_{k-1}^{j_{u}} \text{ is }C_{2}^{f,j_{u}}\text{ and }\dots\text{ and }u_{k-m+1}^{j_{u}}\text{ is }C_{m}^{f,j_{u}}\]3  
This procedure is repeated iteratively in the next time steps from the prediction horizon, resulting in obtaining the normalized firing strengths of the fuzzy rules \(\tilde{w}_{k+i|k}^{f}\) in each, \((k+i)\)th, time step from the prediction horizon.