diff scripts/control/system/is_abcd.m @ 7136:59dcf01bb3e3

[project @ 2007-11-08 20:18:25 by jwe]
author jwe
date Thu, 08 Nov 2007 20:18:26 +0000
parents a1dbe9d80eee
children
line wrap: on
line diff
--- a/scripts/control/system/is_abcd.m	Thu Nov 08 18:54:10 2007 +0000
+++ b/scripts/control/system/is_abcd.m	Thu Nov 08 20:18:26 2007 +0000
@@ -32,61 +32,67 @@
 function retval = is_abcd (a, b, c, d)
 
   retval = 0;
+
   switch (nargin)
-    case (1)
+    case 1
       ## A only
-      [na, ma] = size(a);
+      [na, ma] = size (a);
       if (na != ma)
-        disp("Matrix A ist not square.")
+        disp ("Matrix A ist not square.")
       endif
-    case (2)
+    case 2
       ## A, B only
-      [na, ma] = size(a);  [nb, mb] = size(b);
+      [na, ma] = size (a);
+      [nb, mb] = size(b);
       if (na != ma)
-        disp("Matrix A ist not square.")
+        disp ("Matrix A ist not square.")
         return;
       endif
       if (na != nb)
-        disp("A and B column dimension different.")
+        disp ("A and B column dimension different.")
         return;
       endif
-    case (3)
+    case 3
       ## A, B, C only
-      [na, ma] = size(a);  [nb, mb] = size(b);  [nc, mc] = size(c);
+      [na, ma] = size(a);
+      [nb, mb] = size(b);
+      [nc, mc] = size(c);
       if (na != ma)
-        disp("Matrix A ist not square.")
+        disp ("Matrix A ist not square.")
         return;
       endif
       if (na != nb)
-        disp("A and B column dimensions not compatible.")
+        disp ("A and B column dimensions not compatible.")
         return;
       endif
       if (ma != mc)
-        disp("A and C row dimensions not compatible.")
+        disp ("A and C row dimensions not compatible.")
         return;
       endif
-    case (4)
+    case 4
       ## all matrices A, B, C, D
-      [na, ma] = size(a);  [nb, mb] = size(b);
-      [nc, mc] = size(c);  [nd, md] = size(d);
+      [na, ma] = size(a);
+      [nb, mb] = size(b);
+      [nc, mc] = size(c);
+      [nd, md] = size(d);
       if (na != ma)
-        disp("Matrix A ist not square.")
+        disp ("Matrix A ist not square.")
         return;
       endif
       if (na != nb)
-        disp("A and B column dimensions not compatible.")
+        disp ("A and B column dimensions not compatible.")
         return;
       endif
       if (ma != mc)
-        disp("A and C row dimensions not compatible.")
+        disp ("A and C row dimensions not compatible.")
         return;
       endif
       if (mb != md)
-        disp("B and D row dimensions not compatible.")
+        disp ("B and D row dimensions not compatible.")
         return;
       endif
       if (nc != nd)
-        disp("C and D column dimensions not compatible.")
+        disp ("C and D column dimensions not compatible.")
         return;
       endif
     otherwise
@@ -94,4 +100,5 @@
   endswitch
   ## all tests passed, signal ok.
   retval = 1;
+
 endfunction