Skip to content
Merged
Show file tree
Hide file tree
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
1 change: 1 addition & 0 deletions src/ControlSystems.jl
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ export LTISystem,
isproper,
# Linear Algebra
balance,
balance_statespace,
care,
dare,
dlyap,
Expand Down
9 changes: 5 additions & 4 deletions src/types/conversion.jl
Original file line number Diff line number Diff line change
Expand Up @@ -156,15 +156,16 @@ function siso_tf_to_ss(T::Type, f::SisoRational)
end

"""
`A, B, C, T = balance_statespace{S}(A::Matrix{S}, B::Matrix{S}, C::Matrix{S}, perm::Bool=false)`

`sys, T = balance_statespace(sys::StateSpace, perm::Bool=false)`
A, B, C, T = balance_statespace{S}(A::Matrix{S}, B::Matrix{S}, C::Matrix{S}, perm::Bool=false)
sys, T = balance_statespace(sys::StateSpace, perm::Bool=false)

Computes a balancing transformation `T` that attempts to scale the system so
that the row and column norms of [T*A/T T*B; C/T 0] are approximately equal.
If `perm=true`, the states in `A` are allowed to be reordered.

This is not the same as finding a balanced realization with equal and diagonal observability and reachability gramians, see `balreal`
The inverse of `sysb, T = balance_statespace(sys)` is given by `similarity_transform(sysb, T)`

This is not the same as finding a balanced realization with equal and diagonal observability and reachability gramians, see [`balreal`](@ref)
"""
function balance_statespace(A::AbstractMatrix, B::AbstractMatrix, C::AbstractMatrix, perm::Bool=false)
try
Expand Down
1 change: 1 addition & 0 deletions test/test_matrix_comps.jl
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ sysr, G = balreal(sys)
@test sort(poles(sysr)) ≈ sort(poles(sys))

sysb,T = ControlSystems.balance_statespace(sys)
@test similarity_transform(sysb, T) ≈ sys
Ab,Bb,Cb,T = ControlSystems.balance_statespace(A,B,C)

@test Ab*T ≈ T*A
Expand Down