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

4 次查看(过去 30 天)
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 个评论
Walter Roberson
Walter Roberson 2019-4-24
What is class(S) ? What is rank(S) ? Your reference to numeric::inverse suggests that S might be numeric.
David Wilson
David Wilson 2019-4-24
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.

请先登录,再进行评论。

采纳的回答

Walter Roberson
Walter Roberson 2019-4-24
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 个评论
Walter Roberson
Walter Roberson 2019-4-24
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.

请先登录,再进行评论。

更多回答(0 个)

Community Treasure Hunt

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

Start Hunting!

Translated by