A PHP Error was encountered

Severity: Warning

Message: fopen(/home/polpe/.phpsession/ci_session047190cf07218f83042603394a54b5d441fc9968): 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.

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

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.

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 =

   -1.5538    2.0288   -1.3990   -0.9801
   -0.3543   -0.3672    1.3149    1.8573
    0.4342   -2.3638    0.4038    0.3095
   -0.1015    0.7299   -0.3442   -0.4891


detT =

    0.4459

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] = 
 
   -0.6634    0.2711    0.9518    6.2501
    0.4037   -3.0293   -4.0147  -15.8634
    0.0011   -0.2817   -1.2165   -5.4682
   -0.0914    0.6003    1.0347    4.3345

 
B [4x1] = 
 
    0.1101
    0.3079
    0.5817
   -0.1964

 
C [1x4] = 
 
   -0.0378    2.3169    2.9178   10.7207

 

Controllability, observability matrix

Cn = ctrb(A,B), rank(Cn,rtol)
On = obsv(A,C), rank(On,rtol)
Output:
Cn =

    0.1101   -0.6636    0.2104   -0.2533
    0.3079   -0.1077    0.1202   -0.0642
    0.5817    0.2798    0.0977    0.0569
   -0.1964   -0.0747   -0.0383   -0.0119


ans =

     2


On =

   -0.0378    2.3169    2.9178   10.7207
   -0.0164   -1.4153   -1.7941   -6.4771
    0.0296    0.9002    1.1469    4.0848
   -0.0284   -0.5899   -0.7542   -2.6605


ans =

     2

Controllable subspace $X_{c \cdot} = X_{co} \otimes X_{c \bar o} = \mathrm{Im} \left\{\mathcal{C}_n \right\}$

[U,Sigma,~] = svd(Cn);
XC_ = U(:,1:rank(Sigma,rtol))
% Alternatively:
% Xcx = orth(Cn)
Output:
XC_ =

    0.8548    0.4172
    0.0773    0.4843
   -0.4936    0.7262
    0.1405   -0.2530

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

[~,Sigma,V] = svd(On);
X_o = V(:,rank(Sigma,rtol)+1:end)
% Alternatively:
% Xx_2 = null(On)
Output:
X_o =

    0.4040   -0.5014
   -0.8874   -0.3230
   -0.0672    0.7892
    0.2115   -0.1468

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

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

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

XCO = intersection_of_subspaces(XCo_ORTH', XC_')'
Output:
XCO =

    1.0000
    0.6694
    0.6763
   -0.2524

Orthogonal basis of $X_{co}$

U = orth(XCO);

Transfer function of the original state-space model

H = tf(ss(A,B,C,D));
H_min = minreal(H)
Output:
H_min =
 
    0.3008
  ----------
  s + 0.6949
 
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.3008
  ----------
  s + 0.6949
 
Continuous-time transfer function.

Kalman decomposition

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.6949   -0.0000    6.9603    0.1936
   -0.8157    0.4271  -10.9286   -0.9284
   -0.0000    0.0000   -0.4278   -0.0000
   -0.0000   -0.0000   14.1056    0.1208