A PHP Error was encountered

Severity: Warning

Message: fopen(/home/polpe/.phpsession/ci_session83389ffedf80504215f9dd0d21efe563f80e18d5): failed to open stream: No space left on device

Filename: drivers/Session_files_driver.php

Line Number: 159

Backtrace:

File: /home/polpe/public_html/application/controllers/Main.php
Line: 17
Function: library

File: /home/polpe/public_html/index.php
Line: 315
Function: require_once

Polcz Péter honlapja

Tartalomjegyzék

Standard 1-D order reduction. Demonstration. 2018. February 01.

Teljes Matlab script (és live script) kiegészítő függvényekkel.
Tekintsd meg LiveEditor nézetben is!

  1. Mathmod 2018 LFR cikk-hez kapcsolódóan
  2. CCS irányíthatóság, megfigyelhetőség
  3. LTI geometric approach

Moore 1981, Principal Component Analysis in Linear Systems: Controllability, Observability, and Model Reduction

File: standard_1d_order_reduction.m

Author: Peter Polcz ppolcz@gmail.com

Created on 2017. September 02.

Reviewed on 2017. September 24.

Reviewed on 2018. February 01. (Geometric control approach)

Automatically generated stuff

global SCOPE_DEPTH
SCOPE_DEPTH = 0;

Generate a good transformation matrix

detT = 0;

while ~(0 < detT && detT <= 2)
    T = randn(4);
    detT = det(T);
end
T, detT
Output:
T =
   -0.1807    0.1093   -0.7231    0.5939
    0.0458    1.8140    0.5265   -2.1860
   -0.0638    0.3120   -0.2603   -1.3270
    0.6113    1.8045    0.6001   -1.4410
detT =
    0.9803

Generate a good state-space model

A = [
    1 0 1 0
    1 1 1 1
    0 0 1 0
    0 0 1 1
    ] .* randn(4);

B = [
    1
    1
    0
    0
    ] .* randn(4,1);

C = [ 1 0 1 0 ] .* randn(1,4);

A = T*A/T;
B = T*B;
C = C/T;
D = 0;

rtol = 1e-10;

pcz_display(A,B,C)
Output:
A [4x4] = 
 
    1.2176   -1.3912    2.3540    0.8540
   -3.1447   -4.9249    0.9090    3.9271
    0.0526   -0.8850   -0.3092    0.7581
   -4.0659   -4.9785    1.0343    4.0206
 
B [4x1] = 
 
   -0.1167
   -0.0715
   -0.0562
    0.2754
 
C [1x4] = 
 
   -0.9611    0.1386   -0.7023    0.0403
 

Controllability and observability

$$\left\lbrace \begin{array}{c}\dot{x} =A\text{ }x+B\text{ }y\\y=C\text{ }x+D\text{ }y\end{array}\right.$$

The state space could be partitioned as follows:

$$\mathcal X = \mathcal X_{co} + \mathcal X_{c \bar o} + \mathcal X_{\bar c o} + \mathcal X_{\bar c \bar o}$$

$\mathcal X_{\cdot \cdot}$ are pairwise orthogonal subspaces of the state space.

Controllability matrix:

Cn = ctrb(A,B), rank(Cn,rtol)
Output:
Cn =
   -0.1167    0.0603   -0.0885    0.0830
   -0.0715    1.7495   -1.1670    1.4977
   -0.0562    0.2833   -0.2078    0.2548
    0.2754    1.8796   -1.1050    1.5123
ans =
     2

Observability matrix:

On = obsv(A,C), rank(On,rtol)
Output:
On =
   -0.9611    0.1386   -0.7023    0.0403
   -1.8070    1.0752   -1.8776   -0.6467
   -3.0505    2.1000   -3.3647   -1.3445
   -5.0286    3.5726   -5.6223   -2.3147
ans =
     2

Controllable subspace $\mathcal X_{c \cdot} = \mathcal X_{co} + \mathcal X_{c \bar o} = \mathrm{Im} \left\{C_n \right\}$

[U,Sigma,~] = svd(Cn);
XC_ = U(:,1:rank(Sigma,rtol))
% Alternatively:
% Xcx = orth(Cn)
Output:
XC_ =
    0.0331   -0.4312
    0.6906   -0.5900
    0.1155   -0.2560
    0.7132    0.6328

Unobservable subspace: $\mathcal X_{\cdot \bar o} = \mathcal X_{c \bar o} + \mathcal X_{\bar c o} = \mathrm{Ker} \left\{O_n\right\}$

[~,Sigma,V] = svd(On);
X_o = V(:,rank(Sigma,rtol)+1:end)
% Alternatively:
% Xx_2 = null(On)
Output:
X_o =
   -0.1386   -0.5128
    0.7380   -0.0246
    0.3669    0.6659
    0.5491   -0.5413

Controllable and unobservable sybsystem: $\mathcal X_{c \bar o} = \mathcal X_{c \cdot} \cap \mathcal X_{\cdot \bar o}$

XCo = intersection_of_subspaces(XC_',X_o')';
XCo_ORTH = null(XCo');

Controllable and observable subsystem: $\mathcal X_{co} = (\mathcal X_{c \cdot} \cap \mathcal X_{\cdot \bar o})^\perp \cap \mathcal X_{c \cdot} = \mathcal X_{c \bar o}^\perp \cap \mathcal X_{c \cdot}$

XCO = intersection_of_subspaces(XCo_ORTH', XC_')'
Output:
XCO =
    1.0000
    1.3361
    0.5889
   -1.5056

Orthogonal basis of $\mathcal X_{co}$

U = orth(XCO)
Output:
U =
   -0.4304
   -0.5750
   -0.2535
    0.6480

Transfer function of the original state-space model

H = tf(ss(A,B,C,D));
H_min = minreal(H)
Output:
H_min =
 
    0.1528
  ----------
  s - 0.4018
 
Continuous-time transfer function.

Transfer function of the reduced state-space model

We do not need to use minreal.

A_ = U'*A*U;
B_ = U'*B;
C_ = C*U;
D_ = D;

tf(ss(A_,B_,C_,D_))
Output:
ans =
 
    0.1528
  ----------
  s - 0.4018
 
Continuous-time transfer function.

Kalman decomposition with minreal

The transformation matrix is returned by function minreal.

sys = ss(A,B,C,D);
[sysmin,S] = minreal(sys);
Kalman_decomp_A = S*A/S
Output:
3 states removed.
Kalman_decomp_A =
    0.4018    0.0000   -1.5344    0.4391
    9.5727   -1.0516    2.5233    3.3105
   -0.0000    0.0000    1.6360    0.0000
    0.0000   -0.0000   -1.9160   -0.9821

Basic linear algebra

Image and kernel space of linear transformation $y = Ax$

Let us detonte $\mathcal U = \rm{Im}(A)$, $\mathcal V = \rm{Ker}(A)$, where $A \in \mathbb R^{n \times n}$. It is not necessary that $\mathcal U = \mathcal V^\perp$.

A = [
    0 1
    0 0
    ];

U = orth(A)
V = null(A)
rank([U V])
Output:
U =
     1
     0
V =
    -1
     0
ans =
     1