Is this happening because of precision or something else?

39 views Asked by At

I am trying to solve a big linear system, 117 x 117 in Matlab. But every time I run the code, it gives the output 'NaN' and gives a warning that says "matrix is singular to working precision". Everything else is running well and good. My professor told me to increase the precision of calculation. I have increased it with digits(64) function, but even then Matlab is giving me same output. How can I resolve this issue?

I have tried digits(64) function to increase precision. I have also tried linsolve() function and as usual \ operator.

1

There are 1 answers

0
mond On

have you checked if maybe your matrix is actually singular? Have you checked rank and determinants?

one way to get around this would be to find a solution with the minimum norm. numpy does this by default. There is also a matlab function to do this:

lsqminnorm(A,B)

once you found a solution you can plug it back in (do a matrix multiplication) and see how close you really are.