Mercurial > octave-nkf
view scripts/special-matrix/vander.m @ 4:b4df021f796c
[project @ 1993-08-08 01:26:08 by jwe]
Initial revision
author | jwe |
---|---|
date | Sun, 08 Aug 1993 01:26:08 +0000 |
parents | |
children | 16a24e76d6e0 |
line wrap: on
line source
function retval = vander (c) # usage: vander (c) # # Return the Vandermonde matrix whose next to last column is c. # # See also: hankel, hadamard, hilb, invhilb, toeplitz if (nargin != 1) error ("usage: vander (c)"); endif nr = rows (c); nc = columns (c); if (nr == 1 && nc == 1) retval = 1; elseif (nr == 1 || nc == 1) n = length (c); if (n > 0) retval = zeros (n, n); for i = 1:n tmp = c(i); for j = 1:n retval (i, j) = tmp ^ (n - j); endfor endfor endif else error ("vander: argument must be a vector"); endif endfunction