changeset 10424:f6714bbb8d95 octave-forge

control: remove infinite poles, rename variable
author paramaniac
date Sat, 09 Jun 2012 09:29:34 +0000
parents e90506ce0d0f
children e6ede11be5cf
files main/control/inst/@lti/isstable.m main/control/inst/__is_stable__.m main/control/inst/isstabilizable.m
diffstat 3 files changed, 17 insertions(+), 12 deletions(-) [+]
line wrap: on
line diff
--- a/main/control/inst/@lti/isstable.m	Sat Jun 09 09:02:40 2012 +0000
+++ b/main/control/inst/@lti/isstable.m	Sat Jun 09 09:29:34 2012 +0000
@@ -31,9 +31,9 @@
     print_usage ();
   endif
 
-  eigw = pole (sys);
+  pol = pole (sys);
   ct = isct (sys);
 
-  bool = __is_stable__ (eigw, ct, tol);
+  bool = __is_stable__ (pol, ct, tol);
 
-endfunction
\ No newline at end of file
+endfunction
--- a/main/control/inst/__is_stable__.m	Sat Jun 09 09:02:40 2012 +0000
+++ b/main/control/inst/__is_stable__.m	Sat Jun 09 09:29:34 2012 +0000
@@ -22,12 +22,12 @@
 ## Created: December 2010
 ## Version: 0.1
 
-function bool = __is_stable__ (eigw, ct = true, tol = 0)
+function bool = __is_stable__ (pol, ct = true, tol = 0)
 
   if (ct)  # continuous-time
-    bool = all (real (eigw) < -tol*(1 + abs (eigw)));
+    bool = all (real (pol) < -tol*(1 + abs (pol)));
   else     # discrete-time
-    bool = all (abs (eigw) < 1 - tol);
+    bool = all (abs (pol) < 1 - tol);
   endif
 
-endfunction
\ No newline at end of file
+endfunction
--- a/main/control/inst/isstabilizable.m	Sat Jun 09 09:02:40 2012 +0000
+++ b/main/control/inst/isstabilizable.m	Sat Jun 09 09:29:34 2012 +0000
@@ -1,4 +1,4 @@
-## Copyright (C) 2009, 2010   Lukas F. Reichlin
+## Copyright (C) 2009, 2010, 2012   Lukas F. Reichlin
 ##
 ## This file is part of LTI Syncope.
 ##
@@ -73,7 +73,7 @@
 
 ## Author: Lukas Reichlin <lukas.reichlin@gmail.com>
 ## Created: October 2009
-## Version: 0.3.1
+## Version: 0.4
 
 function bool = isstabilizable (a, b = [], e = [], tol = [], dflg = 0)
 
@@ -109,7 +109,7 @@
     auncont = ac(uncont_idx, uncont_idx);
 
     ## calculate poles of uncontrollable part
-    eigw = eig (auncont);
+    pol = eig (auncont);
   else
     ## controllability staircase form - output matrix c has no influence
     [ac, ec, ~, ~, ~, ~, ncont] = sltg01hd (a, e, b, zeros (1, columns (a)), tol);
@@ -120,10 +120,15 @@
     euncont = ec(uncont_idx, uncont_idx);
 
     ## calculate poles of uncontrollable part
-    eigw = eig (auncont, euncont);
+    pol = eig (auncont, euncont);
+    
+    ## remove infinite poles
+    tolinf = norm ([auncont, euncont], 2);
+    idx = find (abs (pol) < tolinf/eps);
+    pol = pol(idx);
   endif
 
   ## check whether uncontrollable poles are stable
-  bool = __is_stable__ (eigw, ! dflg, tol);
+  bool = __is_stable__ (pol, ! dflg, tol);
 
 endfunction