Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 11 additions & 4 deletions src/matrix_comps.jl
Original file line number Diff line number Diff line change
Expand Up @@ -574,19 +574,26 @@ function baltrunc(sys::ST; atol = sqrt(eps()), rtol = 1e-3, n = nothing, residua
end

"""
syst = similarity_transform(sys, T)
syst = similarity_transform(sys, T; unitary=false)
Perform a similarity transform `T : Tx̃ = x` on `sys` such that
```
à = T⁻¹AT
B̃ = T⁻¹ B
C̃ = CT
D̃ = D
```

If `unitary=true`, `T` is assumed unitary and the matrix adjoint is used instead of the inverse.
"""
function similarity_transform(sys::ST, T) where ST <: AbstractStateSpace
function similarity_transform(sys::ST, T; unitary=false) where ST <: AbstractStateSpace
Tf = factorize(T)
A = Tf\sys.A*T
B = Tf\sys.B
if unitary
A = Tf'sys.A*T
B = Tf'sys.B
else
A = Tf\sys.A*T
B = Tf\sys.B
end
C = sys.C*T
D = sys.D
ST(A,B,C,D,sys.timeevol)
Expand Down