diff scripts/polynomial/polyderiv.m @ 561:e79ff1f4df3c

[project @ 1994-07-25 22:32:08 by jwe] Initial revision
author jwe
date Mon, 25 Jul 1994 22:32:08 +0000
parents
children 3470f1e25a79
line wrap: on
line diff
new file mode 100644
--- /dev/null
+++ b/scripts/polynomial/polyderiv.m
@@ -0,0 +1,33 @@
+function p = polyderiv(p)
+#polyderiv(c)
+#Returns the coefficients of the derivative of the polynomial whose
+#coefficients are given by vector c.
+#
+#SEE ALSO: poly, polyinteg, polyreduce, roots, conv, deconv, residue,
+#          filter, polyval, polyvalm
+
+# Author:
+#  Tony Richardson
+#  amr@mpl.ucsd.edu
+#  June 1994
+
+  if(nargin != 1)
+    error("usage: polyderiv(vector)");
+  endif
+
+  if(is_matrix(p))
+    error("argument must be a vector");
+  endif
+
+  lp = length(p);
+  if(lp == 1)
+    p = 0;
+    return;
+  elseif (lp == 0)
+    p = [];
+    return;
+  end
+
+  p = p(1:(lp-1)) .* [(lp-1):-1:1];
+
+endfunction