Symbolic matrices multipleid incorrectly

1 回表示 (過去 30 日間)
Sergey Kasyanov
Sergey Kasyanov 2021 年 5 月 8 日
コメント済み: Sergey Kasyanov 2021 年 5 月 8 日
Hello!
I have matrix equation:
When I try to find X I get incorrect result:
Check does not pass:
I attach a .mat file with an example. There is a ST structure with M1 and M2 fields in a .mat file. Both are symbolic matrices.
Code for testing.
X = ST.M1^-1 * ST.M2;
disp(ST.M1 * X - ST.M2)
The invertible matrix of M1 is correct. The condition number of M1 is 1. Where is the problem?

回答 (1 件)

Paul
Paul 2021 年 5 月 8 日
What was your actual check that the result does not pass? Maybe you need to simplify() the result?
M1=sym('m1',[2 2]);
M2=sym('m2',[2 2]);
X=M1^-1*M2;
D = M1*X - M2 % looks non-zero
D = 
simplify(D) % is zero
ans = 
  1 件のコメント
Sergey Kasyanov
Sergey Kasyanov 2021 年 5 月 8 日
It does not working.

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeAssumptions についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by