n = 9 %% Set up Vandermode problem x = (2:n+1)' V = single(vander(x)) %% Random RHS y = single(rand(n,1)) %% Compute the result using naive GE a = gauss_elim_outer(V, y) V*a-y %% Plot the points and the curve clf plot(x,y,'o') hold on xs = linspace(1,n+2,201); plot(xs,polyval(a, xs)) axis([1 n+2 -1 2])