Constructor for Statespace Realizations
stsp.RdAny rational (\((m,n)\)-dimensional) matrix \(x(z)\) which has no pole at \(z=0\) may be represented as $$x(z) = C(z^{-1} I_s - A)^{-1} B + D$$ Here \(I_s\) denotes the \((s,s)\)-dimensional identity matrix and \(A,B,C,D\) are (real or complex valued) matrices of size \((s,s)\), \((s,n)\), \((m,s)\) and \((m,n)\) respectively. The integer \(s \geq 0\) is called the state dimension of the above statespace realization of \(x(z)\).
Arguments
- A
\((s,s)\) matrix (or a vector of length \((s^2)\))
- B
\((s,n)\) matrix (or a vector of length \((sn)\))
- C
\((m,s)\) matrix (or a vector of length \((ms)\))
- D
\((m,n)\) matrix (or a vector of length \((mn)\))
Details
Internally statespace realizations are stored as an \((s+m, s+n)\)-dimensional matrix
with an attribute order = c(m,n,s) and a class attribute
c("stsp","ratm").
Any of the integers \(m,n,s\) may be zero.
If the arguments A,B,C are missing, then a statespace realization with
statespace dimension \(s=0\) is constructed. In this case D must a be matrix or
a scalar.
If A,B,C are given (and compatible) and D is missing, then
D = diag(x = 1, nrow = m, ncol = n) is used.
See also
test_stspgenerates random polynomials.checks:
is.stsp,is.miniphase,is.stableandis.minimal.matrix operations: transpose
t.stsp, Hermitean transposeHt,bind,[.stsp, ...extract the system matrices \(A,B,C,D\) with
$.stsp.statespace realizations related tools: state transfromation
state_trafo, observability and controllability matricesobs_matrixandctr_matrix, Grammian matricesgrammiansand balanced realizationsbalance..reflect_polesandreflect_zeroesmay be used to reflect poles and zeroes of a rational matrix in statespace form by multiplication with allpass rational matrices.
Examples
### x(z) = I
stsp(D = diag(3))
#> statespace realization [3,3] with s = 0 states
#> u[1] u[2] u[3]
#> x[1] 1 0 0
#> x[2] 0 1 0
#> x[3] 0 0 1
### random (2 x 3) rational matrix in statespace form with state dimension s = 4
x = stsp(A = stats::rnorm(4*4), B = stats::rnorm(4*3), C = stats::rnorm(2*4))
is.stsp(x)
#> [1] TRUE
dim(x)
#> m n s
#> 2 3 4
str(x)
#> ( 2 x 3 ) statespace realization with s = 4 states
print(x, digits = 3)
#> statespace realization [2,3] with s = 4 states
#> s[1] s[2] s[3] s[4] u[1] u[2] u[3]
#> s[1] 0.383 1.445 -0.910 -0.719 -0.306 0.934 -0.727
#> s[2] 0.476 -3.237 -0.510 1.410 -0.150 0.159 -1.070
#> s[3] -0.328 -0.239 -0.232 -0.111 -1.604 -0.028 0.623
#> s[4] -1.020 -0.225 0.982 1.249 0.016 -0.314 -1.199
#> x[1] -0.001 1.631 -0.415 0.111 1.000 0.000 0.000
#> x[2] 0.998 0.056 -0.437 1.105 0.000 1.000 0.000