diff scripts/control/base/bode_bounds.m @ 7795:df9519e9990c

Handle single precision eps values
author David Bateman <dbateman@free.fr>
date Mon, 12 May 2008 22:57:11 +0200 (2008-05-12)
parents 38fe664f0ef1
children
line wrap: on
line diff
--- a/scripts/control/base/bode_bounds.m
+++ b/scripts/control/base/bode_bounds.m
@@ -48,11 +48,17 @@
     zer = reshape (zer, 1, length (zer));
   endif
 
+  if (isa (zer, "single") || isa (pol, "single"))
+    myeps = eps ("single");
+  else
+    myeps = eps;
+  endif
+
   ## check for natural frequencies away from omega = 0
   if (DIGITAL)
     ## The 2nd conditions prevents log(0) in the next log command
-    iiz = find (abs(zer-1) > norm(zer)*eps && abs(zer) > norm(zer)*eps);
-    iip = find (abs(pol-1) > norm(pol)*eps && abs(pol) > norm(pol)*eps);
+    iiz = find (abs(zer-1) > norm(zer)*myeps && abs(zer) > norm(zer)*myeps);
+    iip = find (abs(pol-1) > norm(pol)*myeps && abs(pol) > norm(pol)*myeps);
 
     ## avoid dividing empty matrices, it would work but looks nasty
     if (! isempty (iiz))
@@ -68,8 +74,8 @@
     endif
   else
     ## continuous
-    iip = find (abs(pol) > norm(pol)*eps);
-    iiz = find (abs(zer) > norm(zer)*eps);
+    iip = find (abs(pol) > norm(pol)*myeps);
+    iiz = find (abs(zer) > norm(zer)*myeps);
 
     if (! isempty (zer))
       czer = zer(iiz);