title: Avoid Generating a singular matrix in MATLAB
body: <p>How would you generate a random matrix that is not singular in MATLAB.?</p>
  
  <p>I know a matrix determinant can be used to do check this, but after reading <a href="http://www.mathworks.com/help/techdoc/ref/det.html" rel="nofollow">MATLAB determinant</a>:</p>
  
  <p>"Using det(X) == 0 as a test for matrix singularity is appropriate only for matrices of modest order with small integer entries. Testing singularity using abs(det(X)) &lt;= tolerance is not recommended as it is difficult to choose the correct tolerance. The function cond(X) can check for singular and nearly singular matrices."</p>
  
  <p>So if I want to generate a <strong>big random matrix (axb) a=5000, b=5000</strong>, How to do it??.</p>