1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
|
function [K_x T] = ppp_open2closed (A_u,A_c,k_x,x_0);
## usage: [K_x T] = ppp_open2closed (A_u,A_c,k_x,x_0);
## K_x is the open-loop matrix as in U = K_w W - K_x x
## Note that K_x is a column vector of matrices - one matrix per input.
## T is the transformation matrix: x = T*Ustar; A_c = T*A_u*T^-1; U = (k_x*T)'
## A_u: The control basis-function matrix
## Us0: The initial value of Ustar
## A_c: closed-loop system matrix
## k_x: closed-loop feedback gain
## x_0: initial state
## Copyright (C) 1999 by Peter J. Gawthrop
## $Id$
## Check sizes
n_o = is_square(A_u);
n_c = is_square(A_c);
if (n_o==0)||(n_c==0)||(n_o!=n_c)
error("A_u and A_c must be square and of the same dimension");
endif
[n_u,n_x] = size(k_x);
## Defaults
if nargin<4
x_0 = zeros(n_c,1);
endif
## Create U*(0)
##Us0 = ppp_ustar(A_u,n_u);
Us0 = ones(1,n_o);
## Decompose A_u and Us0 into two bits:
if n_o==n_c
A_w = [];
u_0 = Us0(1:n_c)'; # Assume same Us0 on each input
else
A_w = A_u(n_c+1:n_o, n_c+1:n_o)
|
|
|
>
|
|
|
>
>
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
|
function [K_x T] = ppp_open2closed (A_u,A_c,k_x,x_0,Us0);
## usage: [K_x T] = ppp_open2closed (A_u,A_c,k_x,x_0[,Us0]);
## K_x is the open-loop matrix as in U = K_w W - K_x x
## Note that K_x is a column vector of matrices - one matrix per input.
## T is the transformation matrix: x = T*Ustar; A_c = T*A_u*T^-1; U = (k_x*T)'
## A_u: The control basis-function matrix
## Us0: The initial value of Ustar
## A_c: closed-loop system matrix
## k_x: closed-loop feedback gain
## x_0: initial state
## Us0: initial basis fun state
## Copyright (C) 1999 by Peter J. Gawthrop
## $Id$
## Check sizes
n_o = is_square(A_u);
n_c = is_square(A_c);
if (n_o==0)||(n_c==0)||(n_o!=n_c)
error("A_u and A_c must be square and of the same dimension");
endif
[n_u,n_x] = size(k_x);
## Defaults
if nargin<4
x_0 = zeros(n_c,1);
endif
if nargin<5 #Create U*(0)
##Us0 = ppp_ustar(A_u,n_u);
Us0 = ones(1,n_o);
endif
## Decompose A_u and Us0 into two bits:
if n_o==n_c
A_w = [];
u_0 = Us0(1:n_c)'; # Assume same Us0 on each input
else
A_w = A_u(n_c+1:n_o, n_c+1:n_o)
|