Teljes Matlab script kiegészítő függvényekkel.
File: d2018_01_13_Kalman_decomp_LPV_v3.m Directory: projects/3_outsel/2018_01_10_LPV_inversion Author: Peter Polcz (ppolcz@gmail.com)
Created on 2018. January 13.
Inherited from
Kalman decomposition
File: Kalman_decomposition.m Directory: demonstrations/oktatas/ccs/2017fall Author: Peter Polcz (ppolcz@gmail.com)
Created on 2018. January 13.
Inhereted from:
CCS 2017 fall. Homework 2. Solutions
File: d2017_10_26_hf2_mo.m Directory: demonstrations/oktatas/ccs/2017fall Author: Peter Polcz (ppolcz@gmail.com)
Created on 2017. October 04. Reviewed on 2017. October 30.
Given the following LPV system:
$$ \begin{aligned} &\Sigma: \left\{\begin{aligned} &\dot x = A(\rho) x + B(\rho) u,~~~ \rho \in \mathcal P \\ &y = C x \\ \end{aligned}\right. \\ &\begin{aligned} \text{where: } & A(\rho) = A_0 + A_1 \rho \in \mathbb{R}^{n\times n} \\ & B(\rho) = B_0 + B_1 \rho \in \mathbb{R}^{n\times r} \\ & C \in \mathbb{R}^{m\times n} \\ & D = 0_{m\times r} \end{aligned} \end{aligned} $$
load LPV_18_01_13_Time211859
A_fh = @(rho) A0 + A1*rho;
B_fh = @(rho) B0 + B1*rho;
C_fh = @(rho) C0 + C1*rho;
D_fh = @(rho) D0 + D1*rho;
A = {A0, A1};
B = {B0, B1};
C = {C0, C1};
D = {D0, D1};
AA = [A{:}];
BB = [B{:}];
\begin{equation} {\LARGE(1) \quad}
A(\rho) =
\left(\begin{array}{ccccccc}
1.0 & -1.1 & 2.7 & -0.068 & 1.0 & -0.39 & -0.68 \\
0 & -1.210^{-3} & -0.67 & 0 & 1.6 & 0 & -0.82 \\
0 & 0.17 & -0.7 & 0 & 1.1 & 0 & -0.55 \\
-0.73 & 2.1 & -3.4 & 0.3 & -3.4 & 2.2 & 0.93 \\
-0.73 & 0.82\rho +0.93 & -1.6 & -1.1 & -2.0 & 0.33 & 0.93 \\
0 & 1.0 & -1.6 & 1.0 & -1.0 & -1.7 & 0 \\
-1.5 & 2.2 & -4.6 & -2.2 & -6.5 & 0.67 & 3.1 \\
\end{array}\right)
\end{equation}
\begin{equation} {\LARGE(2) \quad}
B(\rho) =
\left(\begin{array}{cc}
0.98 & 0.88 \\
0 & 0 \\
0 & 0 \\
0.85\rho -0.5 & -0.44 \\
0.15 & 0.13 \\
-0.23 & -0.21 \\
0.29 & 0.26 \\
\end{array}\right)
\end{equation}
\begin{equation} {\LARGE(3) \quad}
C(\rho) = C =
\left(\begin{array}{ccccccc}
0 & -1.7 & 2.6 & -0.23 & 0.23 & -2.2 & 0 \\
0 & -0.4 & 0.61 & -1.3 & 1.3 & 1.0 & 0 \\
\end{array}\right)
\end{equation}
Nálam az $E_c$ most az $Im(B)$.
Im_B = IMA([B{1} B{2}]);
\begin{equation} {\LARGE(4) \quad}
\mathrm{Im}\big(B(\rho)\big) = \left(\begin{array}{cc}
-0.838 & -0.392 \\
0 & 0 \\
0 & 0 \\
0.424 & -0.906 \\
-0.125 & -0.0586 \\
0.201 & 0.0941 \\
-0.25 & -0.117 \\
\end{array}\right)
\end{equation}
Ker_C = INTS(KER(C{1}), KER(C{2}));
\begin{equation} {\LARGE(5) \quad}
\mathrm{Ker}(C) = \left(\begin{array}{ccccc}
1 & 0 & 0 & 0 & 0 \\
0 & -0.88 & 0 & 0 & 0 \\
0 & -0.386 & -0.585 & 0 & 0 \\
0 & 0.129 & -0.377 & -0.707 & 0 \\
0 & -0.129 & 0.377 & -0.707 & 0 \\
0 & 0.21 & -0.611 & 0 & 0 \\
0 & 0 & 0 & 0 & 1 \\
\end{array}\right)
\end{equation}
We compute $\mathcal V^*$ and $\mathcal R^*$.
[R,V] = CSA([A{1} A{2}], Im_B, Ker_C);
assert(rank(R) == 0 && rank([V Ker_C]) == rank(Ker_C));
assert(rank(INTS(V, Im_B)) == 0)
We ensure that $\mathcal R^* = \{0\}$ and that $\mathcal V^* \subseteq \mathrm{Ker}(C)$. Furthermore, we checked the strong invertibility condition $\mathcal V^* \cap \mathrm{Im}\big(B(\rho)\big) = \{0\}$. This does not imply that $\mathcal V^* \perp \mathrm{Im}\big(B(\rho)\big)$.
\begin{equation} {\LARGE(6) \quad} \mathcal V^* = \left(\begin{array}{ccccc} -1 & 0 & 0 & 0 & 0 \\ 0 & -0.88 & 0 & 0 & 0 \\ 0 & -0.386 & -0.585 & 0 & 0 \\ 0 & 0.129 & -0.377 & -0.707 & 0 \\ 0 & -0.129 & 0.377 & -0.707 & 0 \\ 0 & 0.21 & -0.611 & 0 & 0 \\ 0 & 0 & 0 & 0 & 1 \\ \end{array}\right) \end{equation}Now, let me compute $\mathcal V_2 = V^* \cap \mathrm{Im}\big(B(\rho)\big)^\perp$, and $\mathcal V_1 = \mathcal V^* \cap \mathcal V_2^\perp$. Finally, we obtained an orthonormal basis $( V_1 , V_2 )$ of $\mathcal V^* = \mathcal V_1 \oplus \mathcal V_2$, such that $\mathcal V_1 \perp \mathcal V_2$, $\mathcal V_2 \perp \mathrm{Im}\big(B(\rho)\big)$, furthermore, $\mathcal V_1 = \mathrm{Im}\big(B(\rho)\big)\Big|_{\mathcal V^*}$ is a projection of $\mathrm{Im}\big(B(\rho)\big)$ on $\mathcal V^*$.
V2 = INTS(V,ORTCO(Im_B));
V1 = INTS(V,ORTCO(V2));
\begin{equation} {\LARGE(7) \quad}
\mathcal V_1 = \mathcal V^* \cap \mathrm{Im}\big(B(\rho)\big)^\perp = \left(\begin{array}{cc}
-0.934 & 0 \\
-0.0555 & -0.14 \\
0.0832 & 0.21 \\
0 & 0.812 \\
-0.155 & 0.42 \\
0.126 & 0.317 \\
-0.279 & 0 \\
\end{array}\right)
\end{equation}
\begin{equation} {\LARGE(8) \quad}
\mathcal V_2 = \mathcal V^* \cap \mathrm{Im}\big(B(\rho)\big)^\perp = \left(\begin{array}{ccc}
-0.357 & 0 & 0 \\
0.145 & -0.855 & 0 \\
-0.217 & -0.474 & 0.41 \\
0 & 0 & 0 \\
0.405 & -0.123 & -0.528 \\
-0.328 & 0.1 & 0.428 \\
0.73 & 0.142 & 0.608 \\
\end{array}\right)
\end{equation}
1. variáns
Let $T = \begin{pmatrix} {V^*}^\perp & L \end{pmatrix}^T$, where ${V^*}^\perp$ and $L$ are orthonormal bases for ${\mathcal V^*}^\perp \not\perp \mathcal L \subseteq \mathrm{Im}\big(B(\rho)\big)$, respectively.
L = ORTCO(Im_B);
T = [ ORTCO(V) L(:,1:end) ]';
\begin{equation} {\LARGE(9) \quad}
T = \left(\begin{array}{cc|ccccc}
0 & 0.475 & -0.713 & 0.239 & -0.239 & 0.388 & 0 \\
0 & 0 & 0 & 0.533 & -0.533 & -0.657 & 0 \\
0.381 & 0 & 0 & 0 & -0.336 & 0.539 & -0.672 \\
0 & 1 & 0 & 0 & 0 & 0 & 0 \\
0 & 0 & 1 & 0 & 0 & 0 & 0 \\
0 & 0 & 0 & 0 & 0.932 & 0.227 & -0.283 \\
0 & 0 & 0 & 0 & 0 & 0.78 & 0.626 \\
\end{array}\right)
\end{equation}
tol = 1e-10;
prec = -log10(tol);
N = numel(A);
tA = cell(1,N);
tB = cell(1,N);
tC = cell(1,N);
tD = cell(1,N);
for i = 1:numel(A)
tA{i} = round(T*A{i}/T, prec);
tB{i} = round(T*B{i}, prec);
tC{i} = round(C{i}/T, prec);
tD{i} = round(D{i}, prec);
end
tA_fh = @(rho) tA{1} + tA{2}*rho;
tB_fh = @(rho) tB{1} + tB{2}*rho;
tC_fh = @(rho) tC{1} + tC{2}*rho;
tD_fh = @(rho) tD{1} + tD{2}*rho;
\begin{equation} {\LARGE(10) \quad}
\bar A(\rho) =
\left(\begin{array}{cc|ccccc}
0.99 & 0.93 & 0 & 0.098-0.2\rho & -0.15 & 0 & 0 \\
3.2 & -1.3 & 0 & -0.44\rho -1.6 & 2.3 & 0 & 0 \\ \hline
-9.8 & 8.8 & 4.3 & 3.0-0.28\rho & -3.2 & 9.3 & 4.6 \\
0 & 0 & 0 & -1.210^{-3} & -0.67 & 1.8 & -0.51 \\
0 & 0 & 0 & 0.17 & -0.7 & 1.2 & -0.34 \\
1.4 & -0.91 & -0.7 & 0.77\rho -0.17 & 0.44 & -0.73 & -1.1 \\
4.7 & -3.1 & -2.4 & -0.033 & -0.73 & -6.7 & -2.5 \\
\end{array}\right)
\end{equation}
\begin{equation} {\LARGE(11) \quad}
\bar B(\rho) =
\left(\begin{array}{cc}
0.2\rho -0.24 & -0.22 \\
0.45\rho -0.19 & -0.17 \\ \hline
0 & 0 \\
0 & 0 \\
0 & 0 \\
0 & 0 \\
0 & 0 \\
\end{array}\right)
\end{equation}
\begin{equation} {\LARGE(12) \quad}
\bar C(\rho) = C =
\left(\begin{array}{cc|ccccc}
-3.6 & 1.2 & 0 & 0 & 0 & 0 & 0 \\
-0.85 & -2.1 & 0 & 0 & 0 & 0 & 0 \\
\end{array}\right)
\end{equation}
2. variáns, mivel kezdetben az 1. variáns nem akart működni.
Trying to restrict the dynamics $\Sigma$ to $\mathcal V^* \subseteq \mathrm{Ker}(C)$, where the output will be surely zero. In other words, we need $\Sigma|_{\mathcal V^*}$, which is also the zero dynamics (i.e. the output will be zero).
Let $T = \begin{pmatrix} {V^*}^\perp & V_1 & V_2 \end{pmatrix}^T$, where ${V^*}^\perp$, $V_1$, $V_2$ are orthonormal bases for ${\mathcal V^*}^\perp \perp \mathcal V_1 \perp \mathcal V_2$, respectively.
T = [ ORTCO(V) V1 V2 ]';
\begin{equation} {\LARGE(13) \quad}
T = \left(\begin{array}{cc|cc|ccc}
0 & 0.475 & -0.713 & 0.239 & -0.239 & 0.388 & 0 \\
0 & 0 & 0 & 0.533 & -0.533 & -0.657 & 0 \\
-0.934 & -0.0555 & 0.0832 & 0 & -0.155 & 0.126 & -0.279 \\
0 & -0.14 & 0.21 & 0.812 & 0.42 & 0.317 & 0 \\
-0.357 & 0.145 & -0.217 & 0 & 0.405 & -0.328 & 0.73 \\
0 & -0.855 & -0.474 & 0 & -0.123 & 0.1 & 0.142 \\
0 & 0 & 0.41 & 0 & -0.528 & 0.428 & 0.608 \\
\end{array}\right)
\end{equation}
tol = 1e-10;
prec = -log10(tol);
N = numel(A);
tA = cell(1,N);
tB = cell(1,N);
tC = cell(1,N);
tD = cell(1,N);
for i = 1:numel(A)
tA{i} = round(T*A{i}/T, prec);
tB{i} = round(T*B{i}, prec);
tC{i} = round(C{i}/T, prec);
tD{i} = round(D{i}, prec);
end
tA_fh = @(rho) tA{1} + tA{2}*rho;
tB_fh = @(rho) tB{1} + tB{2}*rho;
tC_fh = @(rho) tC{1} + tC{2}*rho;
tD_fh = @(rho) tD{1} + tD{2}*rho;
\begin{equation} {\LARGE(14) \quad}
\bar A(\rho) =
\left(\begin{array}{cc|cc|ccc}
1.1-0.093\rho & 0.93 & 0.011\rho -0.018 & 0.028\rho -0.045 & 0.046-0.029\rho & 0.17\rho -0.014 & -0.06 \\
0.78-0.21\rho & -1.3 & 0.024\rho +0.28 & 0.061\rho +0.71 & -0.063\rho -0.74 & 0.37\rho +0.22 & 0.96 \\ \hline
1.0-0.06\rho & 0.017 & 7.110^{-3}\rho +0.22 & 0.018\rho +0.88 & 0.66-0.018\rho & 0.11\rho +6.510^{-3} & -1.3 \\
0.16\rho +5.5 & 1.3 & 0.84-0.019\rho & -0.048\rho -2.3 & 0.05\rho +0.33 & 0.54-0.3\rho & 1.7 \\ \hline
0.16\rho +5.4 & 0.86 & 1.4-0.018\rho & -0.047\rho -5.0 & 0.048\rho +1.2 & 1.6-0.28\rho & 3.5 \\
0.48-0.048\rho & 1.5 & 5.610^{-3}\rho +0.17 & 0.014\rho -1.2 & -0.015\rho -0.11 & 0.087\rho +0.17 & 2.3 \\
3.1-0.21\rho & 1.7 & 0.024\rho +0.21 & 0.061\rho -2.4 & 0.85-0.063\rho & 0.37\rho +0.67 & 0.82 \\
\end{array}\right)
\end{equation}
\begin{equation} {\LARGE(15) \quad}
\bar B(\rho) =
\left(\begin{array}{cc}
0.2\rho -0.24 & -0.22 \\
0.45\rho -0.19 & -0.17 \\ \hline
-1.0 & -0.94 \\
0.69\rho -0.41 & -0.37 \\ \hline
0 & 0 \\
0 & 0 \\
0 & 0 \\
\end{array}\right)
\end{equation}
\begin{equation} {\LARGE(16) \quad}
\bar C(\rho) = C =
\left(\begin{array}{cc|cc|ccc}
-3.6 & 1.2 & 0 & 0 & 0 & 0 & 0 \\
-0.85 & -2.1 & 0 & 0 & 0 & 0 & 0 \\
\end{array}\right)
\end{equation}