title: Improving a badly conditioned matrix
body: <p>I have a badly conditioned matrix, whose <a href="http://www.mathworks.com/help/matlab/ref/rcond.html" rel="noreferrer"><code>rcond()</code></a> is close to zero, and therefore, the inverse of that matrix does not come out to be correct. I have tried using <a href="http://www.mathworks.com/help/matlab/ref/pinv.html" rel="noreferrer"><code>pinv()</code></a> but that does not solve the problem. This is how I am taking the inverse:</p>
  
  <pre><code>X = (A)\(b);
  </code></pre>
  
  <p>I looked up for a solution to this problem and found <a href="http://www.mathworks.com/matlabcentral/newsreader/view_thread/258026" rel="noreferrer">this link</a> (last solution) for improving the matrix. The solution there suggests to use this:</p>
  
  <pre><code>A_new = A_old + c*eye(size(A_old));
  </code></pre>
  
  <p>Where <code>c &gt; 0</code>. So far employing this technique works in making the matrix <code>A</code> better conditioned and the resultant solution looks better. However, I investigated using different values of <code>c</code> and the resultant solution depends on the value of chosen <code>c</code>. </p>
  
  <p>Other than manually investigating for the value of <code>c</code>, is there an automatic way through which I can find the value of <code>c</code> for which I get the best solution?</p>