You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/matrix_comps.jl
+29-9Lines changed: 29 additions & 9 deletions
Original file line number
Diff line number
Diff line change
@@ -507,19 +507,23 @@ end
507
507
508
508
509
509
"""
510
-
sysr, G, T = baltrunc(sys::StateSpace; atol = √ϵ, rtol=1e-3, unitgain=true, n = nothing)
510
+
sysr, G, T = baltrunc(sys::StateSpace; atol = √ϵ, rtol=1e-3, n = nothing, residual = false)
511
511
512
512
Reduces the state dimension by calculating a balanced realization of the system sys, such that the observability and reachability gramians of the balanced system are equal and diagonal `G`, and truncating it to order `n`. If `n` is not provided, it's chosen such that all states corresponding to singular values less than `atol` and less that `rtol σmax` are removed.
513
513
514
514
`T` is the similarity transform between the old state `x` and the newstate `z` such that `Tz = x`.
515
515
516
-
If `unitgain=true`, the matrix `D` is chosen such that unit static gain is achieved.
516
+
If `residual = true`, matched static gain is achieved through "residualization", i.e., setting
517
+
```math
518
+
0 = A_{21}x_{1} + A_{22}x_{2} + B_{2}u
519
+
```
520
+
where indices 1/2 correspond to the remaining/truncated states respectively.
517
521
518
522
See also `gram`, `balreal`
519
523
520
524
Glad, Ljung, Reglerteori: Flervariabla och Olinjära metoder
521
525
"""
522
-
functionbaltrunc(sys::ST; atol =sqrt(eps()), rtol =1e-3, unitgain=true, n =nothing) where ST <:AbstractStateSpace
526
+
functionbaltrunc(sys::ST; atol =sqrt(eps()), rtol =1e-3, n=nothing, residual=false) where ST <:AbstractStateSpace
523
527
sysbal, S, T =balreal(sys)
524
528
S =diag(S)
525
529
if n ===nothing
@@ -529,12 +533,28 @@ function baltrunc(sys::ST; atol = sqrt(eps()), rtol = 1e-3, unitgain = true, n =
0 commit comments