diff scripts/polynomial/polyinteg.m @ 559:4e826edfbc56

[project @ 1994-07-25 22:18:28 by jwe] Initial revision
author jwe
date Mon, 25 Jul 1994 22:19:05 +0000
parents
children 3470f1e25a79
line wrap: on
line diff
new file mode 100644
--- /dev/null
+++ b/scripts/polynomial/polyinteg.m
@@ -0,0 +1,38 @@
+function p = polyinteg(p)
+#polyinteg(c)
+#Returns the coefficients of the integral the polynomial whose coefficients
+#are represented by the vector c.
+#
+#The constant of integration is zero.
+#
+#SEE ALSO: poly, polyderiv, polyreduce, roots, conv, deconv, residue,
+#          filter, polyval, polyvalm
+
+# Author:
+#  Tony Richardson
+#  amr@mpl.ucsd.edu
+#  June 1994
+
+  if(nargin != 1)
+    error("usage: polyinteg(vector)");
+  endif
+
+  if(is_matrix(p))
+    error("argument must be a vector");
+  endif
+
+  lp = length(p);
+
+  if(lp == 0)
+    p = [];
+    return;
+  end
+
+  if(rows(p) > 1)
+    # Convert to column vector
+    p = p.';
+  endif
+
+  p = [ p 0 ] ./ [lp:-1:1 1];
+
+endfunction