Print Methods
print.Rd
Printing rational matrix objects.
Usage
# S3 method for lpolm
print(
x,
digits = NULL,
format = c("i|jz", "i|zj", "iz|j", "zi|j", "i|j|z", "character"),
...
)
# S3 method for polm
print(
x,
digits = NULL,
format = c("i|jz", "i|zj", "iz|j", "zi|j", "i|j|z", "character"),
...
)
# S3 method for lmfd
print(
x,
digits = NULL,
format = c("i|jz", "i|zj", "iz|j", "zi|j", "i|j|z", "character"),
...
)
# S3 method for rmfd
print(
x,
digits = NULL,
format = c("i|jz", "i|zj", "iz|j", "zi|j", "i|j|z", "character"),
...
)
# S3 method for stsp
print(x, digits = NULL, ...)
# S3 method for pseries
print(
x,
digits = NULL,
format = c("i|jz", "i|zj", "iz|j", "zi|j", "i|j|z"),
...
)
# S3 method for zvalues
print(
x,
digits = NULL,
format = c("i|jz", "i|zj", "iz|j", "zi|j", "i|j|z"),
...
)
Arguments
- x
rational matrix object, i.e. a
polm
,lpolm
,lmfd
,rmfd
,stsp
,pseries
orzvalues
object.- digits
(integer) if non
NULL
then correspondingly rounded numbers are printed, seeround
.- format
(character string) selects specific output formats. Note that
stsp
objects have no format option. The option'character'
is only implemented for polynomials, Laurent polynomials, LMFDs and RMFDs with real coefficients, se- ...
Further parameters are ignored.
Examples
# for polynomials six different print formats are implemented ###################
a = test_polm(dim = c(2,3), degree = 2, random = TRUE)
for (fmt in c("i|jz", "i|zj", "iz|j", "zi|j", "i|j|z", "character")) {
cat('\nformat =', fmt, '\n')
print(a, digits = 2, format = fmt)
}
#>
#> format = i|jz
#> ( 2 x 3 ) matrix polynomial with degree <= 2
#> z^0 [,1] [,2] [,3] z^1 [,1] [,2] [,3] z^2 [,1] [,2] [,3]
#> [1,] -0.50 -0.72 -1.11 -0.10 -1.36 0.16 1.19 -1.10 0.09
#> [2,] 1.05 -0.36 -1.16 -0.09 0.05 -1.10 -0.18 0.44 0.53
#>
#> format = i|zj
#> ( 2 x 3 ) matrix polynomial with degree <= 2
#> [,1] z^0 z^1 z^2 [,2] z^0 z^1 z^2 [,3] z^0 z^1 z^2
#> [1,] -0.50 -0.10 1.19 -0.72 -1.36 -1.10 -1.11 0.16 0.09
#> [2,] 1.05 -0.09 -0.18 -0.36 0.05 0.44 -1.16 -1.10 0.53
#>
#> format = iz|j
#> ( 2 x 3 ) matrix polynomial with degree <= 2
#> [,1] [,2] [,3]
#> z^0 [1,] -0.50 -0.72 -1.11
#> [2,] 1.05 -0.36 -1.16
#> z^1 [1,] -0.10 -1.36 0.16
#> [2,] -0.09 0.05 -1.10
#> z^2 [1,] 1.19 -1.10 0.09
#> [2,] -0.18 0.44 0.53
#>
#> format = zi|j
#> ( 2 x 3 ) matrix polynomial with degree <= 2
#> [,1] [,2] [,3]
#> [1,] z^0 -0.50 -0.72 -1.11
#> z^1 -0.10 -1.36 0.16
#> z^2 1.19 -1.10 0.09
#> [2,] z^0 1.05 -0.36 -1.16
#> z^1 -0.09 0.05 -1.10
#> z^2 -0.18 0.44 0.53
#>
#> format = i|j|z
#> ( 2 x 3 ) matrix polynomial with degree <= 2
#> , , z^0
#>
#> [,1] [,2] [,3]
#> [1,] -0.50 -0.72 -1.11
#> [2,] 1.05 -0.36 -1.16
#>
#> , , z^1
#>
#> [,1] [,2] [,3]
#> [1,] -0.10 -1.36 0.16
#> [2,] -0.09 0.05 -1.10
#>
#> , , z^2
#>
#> [,1] [,2] [,3]
#> [1,] 1.19 -1.10 0.09
#> [2,] -0.18 0.44 0.53
#>
#>
#> format = character
#> ( 2 x 3 ) matrix polynomial with degree <= 2
#> [,1] [,2] [,3]
#> [1,] -0.5 - 0.1z + 1.19z^2 -0.72 - 1.36z - 1.1z^2 -1.11 + 0.16z + 0.09z^2
#> [2,] 1.05 - 0.09z - 0.18z^2 -0.36 + 0.05z + 0.44z^2 -1.16 - 1.1z + 0.53z^2
# "empty" (2 x 0) polynomial matrix (degree = 2)
a = test_polm(dim = c(2,0), degree = 0)
print(a)
#> ( 2 x 0 ) matrix polynomial with degree <= -1
# random (2 x 1) polynomial matrix with complex coefficients (degree = 2)
a = polm(array(complex(real = stats::rnorm(2*1*3),
imaginary = stats::rnorm(2*1*3)), dim = c(2,1,3)))
print(a, digits = 2)
#> ( 2 x 1 ) matrix polynomial with degree <= 2
#> z^0 [,1] z^1 [,1] z^2 [,1]
#> [1,] 1.10+1.18i -0.14-0.62i 0.74+0.55i
#> [2,] -1.36+0.14i -0.16-1.64i 0.34+0.65i
if (FALSE) {
# the format option 'character' is only implemented for polynomials matrices
# with real coefficients!
print(a, digits = 2, format = 'character')
}
# print a rational matrix in statespace form
a = test_stsp(dim = c(3,3), s = 2)
print(a, digits = 2)
#> statespace realization [3,3] with s = 2 states
#> s[1] s[2] u[1] u[2] u[3]
#> s[1] -0.20 0.06 1.48 -0.09 -0.33
#> s[2] 0.88 -2.29 0.55 -0.76 -0.57
#> x[1] -1.39 0.79 1.00 0.00 0.00
#> x[2] -0.24 -0.41 0.00 1.00 0.00
#> x[3] -0.33 0.98 0.00 0.00 1.00
# print a rational matrix in 'lmfd' form
a = test_lmfd(dim = c(2,3), degrees = c(2,1))
print(a, digits = 2, format = 'character')
#> ( 2 x 3 ) left matrix fraction description a^(-1)(z) b(z) with degrees (p = 2, q = 1)
#> left factor a(z):
#> [,1] [,2]
#> [1,] 1 + 0.9z - 0.35z^2 -0.14z - 1.01z^2
#> [2,] -0.05z + 0.76z^2 1 - 0.91z - 0.43z^2
#> right factor b(z):
#> [,1] [,2] [,3]
#> [1,] -0.6 + 1.6z 1.14 - 0.71z -0.05 + 0.63z
#> [2,] -0.2 + 0.28z -1.87 - 0.2z -0.93 + 1.49z
# print impulse response
print(pseries(a), format = 'i|zj', digits = 2)
#> ( 2 x 3 ) impulse response with maximum lag = 5
#> [,1] lag=0 lag=1 lag=2 lag=3 lag=4 lag=5 [,2] lag=0 lag=1 lag=2
#> [1,] -0.6 2.11 -2.31 2.97 -3.11 2.77 1.14 -2.00 0.05
#> [2,] -0.2 0.07 0.55 -1.21 1.05 -1.99 -1.87 -1.84 -3.45
#> lag=3 lag=4 lag=5 [,3] lag=0 lag=1 lag=2 lag=3 lag=4 lag=5
#> [1,] -3.11 -1.02 -3.15 -0.05 0.54 -1.35 2.09 -2.10 2.83
#> [2,] -2.39 -3.85 -2.21 -0.93 0.64 0.25 0.02 1.26 -0.55
# print frequency response
print(zvalues(a), format = 'iz|j', digits = 2)
#> ( 2 x 3 ) frequency response
#> [,1] [,2] [,3]
#> z=1+0i [1,] -0.82+0.00i -8.53+0.00i 1.50+0.00i
#> [2,] -1.96+0.00i -11.80+0.00i 1.51+0.00i
#> z=0.309-0.951i [1,] 0.12-0.64i 1.03+0.44i 0.22+0.22i
#> [2,] -0.20-0.38i -0.24+1.08i -0.75-0.33i
#> z=-0.809-0.588i [1,] 2.78-2.26i 0.03+2.33i 2.75+0.16i
#> [2,] -1.89-0.87i 0.00-0.34i -1.87-1.72i
#> z=-0.809+0.588i [1,] 2.78+2.26i 0.03-2.33i 2.75-0.16i
#> [2,] -1.89+0.87i 0.00+0.34i -1.87+1.72i
#> z=0.309+0.951i [1,] 0.12+0.64i 1.03-0.44i 0.22-0.22i
#> [2,] -0.20+0.38i -0.24-1.08i -0.75+0.33i