I’m working with 6×6 matrices which have varying precisions of data. When I try to inverse that matrix in MATLAB I usually get Inf or NaN as all the data and MATLAB throws a warning:
Matrix is singular to working precision.
Is there anyway to avoid it and get proper results?
Your matrix seems to be rank deficient. Only full rank matrices can be robustly inverted.
You may circumvent your problem by adding a small identity matrix to the original one.