changeset 6650:770c6c36ae2f octave-forge

control-oo: style fixes
author paramaniac
date Sun, 07 Feb 2010 17:26:21 +0000
parents ddf8d96fe1da
children fbd42a8df14f
files extra/control-oo/inst/@lti/norm.m extra/control-oo/src/slab13bd.cc extra/control-oo/src/slab13dd.cc
diffstat 3 files changed, 15 insertions(+), 13 deletions(-) [+]
line wrap: on
line diff
--- a/extra/control-oo/inst/@lti/norm.m	Sun Feb 07 08:08:10 2010 +0000
+++ b/extra/control-oo/inst/@lti/norm.m	Sun Feb 07 17:26:21 2010 +0000
@@ -65,12 +65,13 @@
 function gain = h2norm (sys)
 
   if (isstable (sys))
-    [a, b, c, d, tsam] = ssdata (sys);
+    [a, b, c, d] = ssdata (sys);
+    digital = ! isct (sys);
     
-    if (tsam <= 0 && ! all (all (d == 0)))  # continuous and non-zero feedthrough
+    if (! digital && ! all (all (d == 0)))  # continuous and non-zero feedthrough
       gain = inf;
     else
-      [gain, iwarn] = slab13bd (a, b, c, d, tsam);
+      [gain, iwarn] = slab13bd (a, b, c, d, digital);
     
       if (iwarn)
         warning ("lti: norm: slab13bd: iwarn = %d", iwarn);
@@ -86,12 +87,13 @@
 function [gain, wpeak] = linfnorm (sys, tol = 0.01)
 
   [a, b, c, d, tsam] = ssdata (sys);
+  digital = ! isct (sys);
   tol = max (tol, 100*eps);
   
-  [fpeak, gpeak] = slab13dd (a, b, c, d, tsam, tol);
+  [fpeak, gpeak] = slab13dd (a, b, c, d, digital, tol);
   
   if (fpeak(2) > 0)
-    if (tsam > 0)
+    if (digital)
       wpeak = fpeak(1) / tsam;
     else
       wpeak = fpeak(1);
--- a/extra/control-oo/src/slab13bd.cc	Sun Feb 07 08:08:10 2010 +0000
+++ b/extra/control-oo/src/slab13bd.cc	Sun Feb 07 17:26:21 2010 +0000
@@ -88,12 +88,12 @@
         NDArray b = args(1).array_value ();
         NDArray c = args(2).array_value ();
         NDArray d = args(3).array_value ();
-        double tsam = args(4).double_value ();
+        int digital = args(4).int_value ();
 
-        if (tsam > 0)
+        if (digital == 0)
+            dico = 'C';
+        else
             dico = 'D';
-        else
-            dico = 'C';
         
         int n = a.rows ();      // n: number of states
         int m = b.columns ();   // m: number of inputs
--- a/extra/control-oo/src/slab13dd.cc	Sun Feb 07 08:08:10 2010 +0000
+++ b/extra/control-oo/src/slab13dd.cc	Sun Feb 07 17:26:21 2010 +0000
@@ -88,13 +88,13 @@
         NDArray c = args(2).array_value ();
         NDArray d = args(3).array_value ();
         double* e = 0;
-        double tsam = args(4).double_value ();
+        int digital = args(4).int_value ();
         double tol = args(5).double_value ();
         
-        if (tsam > 0)
+        if (digital == 0)
+            dico = 'C';
+        else
             dico = 'D';
-        else
-            dico = 'C';
         
         int n = a.rows ();      // n: number of states
         int m = b.columns ();   // m: number of inputs