view scripts/polynomial/polyderiv.m @ 707:d7c4962ec7a0

[project @ 1994-09-16 13:50:20 by jwe]
author jwe
date Fri, 16 Sep 1994 13:53:18 +0000
parents e79ff1f4df3c
children 3470f1e25a79
line wrap: on
line source

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