function ShowEffectOfCondition()
% Solve increasingly ill-conditioned systems with known solution.
for n=5:15
% Generate the system and solve it...
A = Pascal(n);
b = A*ones(n,1);
[L,U,p] = lu(A,'vector');
x = U\(L\b(p));
% Display the results...
clc
fprintf('n = %1d\ncond(A) = %10.3e\n',n,cond(A))
fprintf('Solve Ax = A*ones(n,1) where A = Pascal(n)\n\n')
fprintf('x =\n')
fprintf('%25.15f\n',x)
fprintf('\n|| x - xExact || / || xExact || = %10.3e\n',norm(x-ones(n,1))/norm(ones(n,1)))
fprintf('\n cond(A)*eps = %10.3e\n',cond(A)*eps)
pause
end