I have a problem while evaluating inverse using inv in MATLAB.
My matrix looks like this:
term1 =
29929 29756 29929 0 29756 29756
29756 29584 29756 0 29584 29584
29929 29756 29929 0 29756 29756
0 0 0 0 0 0
29756 29584 29756 0 29584 29584
29756 29584 29756 0 29584 29584
when i try to calculate inverse, MATLAB throws a warning Matrix is singular to working precision and the result is:
ans =
Inf Inf Inf Inf Inf Inf
Inf Inf Inf Inf Inf Inf
Inf Inf Inf Inf Inf Inf
Inf Inf Inf Inf Inf Inf
Inf Inf Inf Inf Inf Inf
Inf Inf Inf Inf Inf Inf
Can anyone tell me why this is happening and any ways to resolve it and get the correct result?
As described in the comments:
The issue is not matlab related, the matrix is really singular (As are all matrices that contain a zero row or column).
If you need some kind of inverse, you can try the pseudo inverse with
pinvIf you need to solve equations you can use the backslash operator as such:
x=A∖b