Sam
Sam

Reputation: 949

Matrix is close to singular or badly scaled. Results may be inaccurate

I am using this code and data when I use this command:

[imgw, imgwr, map] = tpswarp(img, outDim, Zp, Zs, interp);   , 

I get this error:

Matrix is close to singular or badly scaled. Results may be inaccurate.

Is there any reason for this error? How I can resolve this issue and run the code? Should I change the Zp and Zs?

Upvotes: 2

Views: 14859

Answers (1)

rayryeng
rayryeng

Reputation: 104484

When a matrix is singular or badly scaled, this means that your matrix is ill-conditioned. This means two things:

  1. The matrix's inverse has a very inaccurate inverse, so solutions using this matrix will be very inaccurate.
  2. When you subject the matrix to small changes, any numerical calculations that you use with the matrix will have such large differences in the output and so the results are unreliable.

The error you're getting is probably attributed to Zp and Zs. Also, this most likely means that Zp and Zs are poorly constructed. Double-check its construction and try again.

As a side question, what is Zp and Zs? Once I know this, I'll edit my post and suggest ways to circumvent this error.

Upvotes: 2

Related Questions