diff scripts/polynomial/polyvalm.m @ 2716:2b5c27299cde

[project @ 1997-02-22 08:40:55 by jwe]
author jwe
date Sat, 22 Feb 1997 08:44:22 +0000
parents 5ca126254d15
children 8b262e771614
line wrap: on
line diff
--- a/scripts/polynomial/polyvalm.m
+++ b/scripts/polynomial/polyvalm.m
@@ -46,7 +46,7 @@
     usage ("polyvalm (c, x)");
   endif
 
-  if (is_matrix (c))
+  if (! (is_vector (c) || isempty (c)))
     error("poly: first argument must be a vector.");
   endif
 
@@ -54,7 +54,12 @@
     error("poly: second argument must be a square matrix.");
   endif
 
-  [v, d] = eig(x);
+  if (isempty (c))
+    y = [];
+    return;
+  endif
+
+  [v, d] = eig (x);
 
   y = v * diag (polyval (c, diag (d))) * v';