MATLAB: How do i set a threshold on the values of the indices in the matrices for the entire code

MATLABquantization errorsmall matrix valuesthreshold

the code i am using has many matrices. Some of these indices are very small in value. So i want to limit the value i.e. i want to add a threshold to the values of my matrix so that the absolute value is not less than 10e-10
is there a setting or function in matlab that will allow me to do this in one swoop ?
thank you

Best Answer

  • Try this
    M(abs(M)<=1e-9) = 1e-9;
    where M is a matrix.