-
Notifications
You must be signed in to change notification settings - Fork 85
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update prescale
function
#465
Conversation
src/matrix_comps.jl
Outdated
C = sys.C*S | ||
normalized_sys = iscontinuous(sys) ? ss(A, B, C, sys.D) : ss(A, B, C, sys.D, sys.Ts) | ||
return normalized_sys, S | ||
function prescale(sys::StateSpace) where ST <: AbstractStateSpace |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
function prescale(sys::StateSpace) where ST <: AbstractStateSpace | |
function prescale(sys::ST) where ST <: AbstractStateSpace |
Codecov Report
@@ Coverage Diff @@
## master #465 +/- ##
==========================================
+ Coverage 85.20% 85.21% +0.01%
==========================================
Files 31 31
Lines 3102 3105 +3
==========================================
+ Hits 2643 2646 +3
Misses 459 459
Continue to review full report at Codecov.
|
S, P, B = balance(metasys) | ||
|
||
# reconstruct A, B and C by taking slices of the balanced metasystem | ||
bal_metasys = P\B*P # undo permutation |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would it be possible to use perm=false
to avoid having to undo the permutation?
such that their column and row norms are closer. | ||
This results in a system with overall better numerical conditioning. | ||
|
||
Returns a new scaled state-space object. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you have any reference to where this method is discussed?
# create an augmented system to balance the whole system at once | ||
metasys = [sys.A sys.B; sys.C zeros(p, m)] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You are using two terms here, both augmented and meta system. I seem to remember that it is instead typically called a packed representation? I think that is the term used in the Essentials of Robust Control by Zhou & Doyle,
I think it should be okay to just call the packed system representation M
as you do in the tests.
nsys = prescale(sys) | ||
@test pole(nsys) ≈ pole(sys) | ||
n, m = size(sys.B) | ||
p = size(sys.C, 1) | ||
M = [nsys.A nsys.B; nsys.C zeros(p, m)] | ||
M2 = [sys.A sys.B; sys.C zeros(p, m)] | ||
@test cond(M) <= cond(M2) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it would be reasonable with quite a few more tests. For example to see that the system dynamics isn't changed by the prescaling. E.g. by comparing the frequency response of a MIMO systems before and after.
Prescale function now actually balances the system matrices A, B and C instead of performing a similarity transformation into diagonal form.