% numerical rank of Vandermonde matrix
% barnett 9/30/08

n = 100;                   % size of matrix
x = linspace(-1,1,n);      % equally-spaced x values in [-1,1]

A = vander(x);
A = A(:,end:-1:1);         % reverse order of cols
rank(A)                    % in theory rank=n. But will be less than n for n>32
s = svd(A);
semilogy(s, '+-');         % examine singular values; notice they stop at 1e-16
