Returns the Vandermonde matrix
A = makematrix_vandermonde ( x ) A = makematrix_vandermonde ( x , n )
a m-by-1 or 1-by-m matrix of doubles
a 1-by-1 matrix of doubles, integer value
a m-by-n matrix of doubles, the Vandermonde matrix of x.
Returns the Vandermonde matrix of size n, made with entries from x.
For i = 1, 2, ..., m and j = 1, 2, ..., n, we have
A(i,j) = x(i)^(j-1)
The determinant of Vandermonde's matrix is
Caution: in Matlab, the columns produced by the "vander" function are reversed.
A = makematrix_vandermonde ( 1:5 ) // Get only the first 3 columns, i.e. // up to power 2. A = makematrix_vandermonde ( 1:5 , 3 ) // Compare exact determinant with Scilab's det n = 5; x = (1:n)'; A = makematrix_vandermonde ( x ) // Compute exact determinant d = 1.; for i = 1: n for j = i+1: n d = d * (x(j) - x(i)); end end disp([det(A) d]) | ![]() | ![]() |
http://en.wikipedia.org/wiki/Vandermonde_matrix