% Curing Wilkinson's counterexample by random perturbation
% Theory: Spielman and Teng
res = [];
for n=10:10:200
  % Build Wilkinson matrix
  A = [tril(-ones(n,n-1))+2*[eye(n-1);zeros(1,n-1)],ones(n,1)];
  % Compute condition number using MATLAB's 'cond' function
  res = [res; n cond(A)];
end
plot(res(:,1),res(:,2),'r-+');
title('Condition number of Wilkinson matrix','fontsize',14);
xlabel('matrix size n','fontsize',14);
ylabel('Euclidean condition number','fontsize',14);