why is inv of matlab not working like numeric::inverse of mupad?

4 views (last 30 days)
S = Sylvester matrix
ARK = Vector with 12 elements
Theta = numeric::inverse(S)*ARK
THIS works fine!
But in matlab the equation
Theta = inv(S)*ARK or Theta = S\ARK
doesn't work! Has anybody an idea why?
Thank you very much
  4 Comments
Walter Roberson
Walter Roberson on 24 Apr 2019
What is class(S) ? What is rank(S) ? Your reference to numeric::inverse suggests that S might be numeric.
David Wilson
David Wilson on 24 Apr 2019
If this is from a control application, then make sure you don have any common factors in your A and B polynomials. If you do, then S is known to be singular.

Sign in to comment.

Accepted Answer

Walter Roberson
Walter Roberson on 24 Apr 2019
numeric::inverse processes the numbers symbolically. The default conversion is floating point to nearby algebraic numbers or pi. The calculations then proceed as rational. Even if you converted to symbolic floating point it would use 32 digits by default.
  1 Comment
Walter Roberson
Walter Roberson on 24 Apr 2019
It is not uncommon that when you convert floating point to rational, that the determinant can be calculated as being slightly different than zero, allowing you to find the inverse of the matrix. It just isn't necessarily numerically stable: if the inputs had been different by even 1 bit of roundoff then the answers might have been different.
Likewise, when you convert from double precision to software floating point and use the default 32 significant digits (plus 3 to 5 guard digits), it is not uncommon for you to be able to use calculations that do not cancel out down to the last digits, and so allow you to calculate something . But again, if the original numbers had changed even slightly then the answers might have been completely different.
When I see an rcond that small, 1e-43, I would tend to think it very likely that there is a true singularity in the calculations and that the numeric solutions you get are probably not of any value -- or that they are only one of a solution family.

Sign in to comment.

More Answers (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!