title: Solving matrices of the form Ax = B ==> error: Matrix is close to singular or badly scaled
body: <p>I'm having trouble solving a system of the form Ax=B</p>
  
  <p>The solution to the system should be </p>
  
  <pre><code>x = inv(A)*B
  </code></pre>
  
  <p>However, this doesn't work.</p>
  
  <p>I get the following error message when I try the above line of code:</p>
  
  <pre><code>Warning: Matrix is close to singular or badly scaled.
       Results may be inaccurate. RCOND = 1.156482e-018. 
  </code></pre>
  
  <p>It seems that matlab is having trouble inverting the matrix that I've specified. I tried to verify that the inverse function was working properly by typing in inv(A)*A</p>
  
  <p>This should give the identity matrix, however I got the same error and some garbage numbers.</p>
  
  <p>This is the A matrix that I'm using:</p>
  
  <pre><code>A = [5/2   1/2  -1     0     0    -1/2  -1/2   0     0
       1/2   1/2   0     0     0    -1/2  -1/2   0     0 
      -1     0     5/2  -1/2  -1     0     0    -1/2   1/2
       0     0    -1/2   1/2   0     0     0     1/2  -1/2
       0     0    -1     0     3/2  -1/2   1/2   0     0
      -1/2  -1/2   0     0    -1/2   2     0    -1     0  
      -1/2  -1/2   0     0     1/2   0     1     0     0 
       0     0    -1/2   1/2   0    -1     0     2     0 
       0     0     1/2  -1/2   0     0     0     0     1]
  </code></pre>
  
  <p>Any ideas as to why this isn't working? I also tried to convert A to a sparse matrix (sparse(A)), and then run the inverse command. No dice.</p>