i want to compare between 3 matrices

2 ビュー (過去 30 日間)
Hassan Bosha
Hassan Bosha 2020 年 4 月 6 日
コメント済み: Hassan Bosha 2020 年 4 月 6 日
I have an equation that i have 3 matrices
i should compare to each other with an if statment
I1 and I2 are matrices
plus what if i want to compare I1 == I2 == I3
if true i would print something
if I1 == I2
disp('I1 = I2')
end

回答 (1 件)

Alex Mcaulley
Alex Mcaulley 2020 年 4 月 6 日
Use isequal:
if isequal(I1,I2,I3)
disp('I1 == I2 == I3')
end
  2 件のコメント
Hassan Bosha
Hassan Bosha 2020 年 4 月 6 日
I don't why it's not working although they equal each other
P1 = [ 1 2 3 ];
RPY1 = [ 30 20 10];
AtoB_1 = transl([P1])*rpy2tr([RPY1]);
BtoA_1 = inv(AtoB_1);
I1 = AtoB_1 * BtoA_1
I2 = BtoA_1 * AtoB_1
I3 = eye(4)
if isequal(I1,I2,I3)
disp('I1 == I2 == I3')
end
Hassan Bosha
Hassan Bosha 2020 年 4 月 6 日
I solved it by rounding matrix I1 and I2

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

カテゴリ

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

Community Treasure Hunt

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

Start Hunting!

Translated by