フィルターのクリア

Info

この質問は閉じられています。 編集または回答するには再度開いてください。

Adding matrices, resulting matrix is only a copy of one of the matrices being added

1 回表示 (過去 30 日間)
Emma
Emma 2012 年 10 月 14 日
閉鎖済み: MATLAB Answer Bot 2021 年 8 月 20 日
I am attempting to add three matrices although when I do so, the resulting matrix is the same as one of the matrices being added rather than a combination of the three.
For example, if I am trying to add matrices A, B and C, when I add them, the contents of the resulting matrix are the same as A alone.
What is a possible explanation for this?

回答 (2 件)

Wayne King
Wayne King 2012 年 10 月 14 日
編集済み: Wayne King 2012 年 10 月 14 日
Are these large matrices? Can you show us? Of course it is possible that
A = A+B+C
but that means that B+C must necessarily be the additive identity (matrix of zeros)
For example:
A = randi([-5 5],10,10);
B = randi([-3 3],10,10);
C = -B;
A+B+C
  1 件のコメント
Emma
Emma 2012 年 10 月 14 日
Each matrix is a 2400x2400 double, comprised of 0s and positive decimals which should add easily. I have also checked the contents of each matrix and they appear to be unique, so A+B+C should be different from any of the individual matrices.

Walter Roberson
Walter Roberson 2012 年 10 月 14 日
This could happen if the values in B and C were much smaller than the values in A. For example, [1] + [1e-30] + [1e-50] is going to be [1]
  2 件のコメント
Emma
Emma 2012 年 10 月 14 日
Each value is between 0 and 1.
Walter Roberson
Walter Roberson 2012 年 10 月 14 日
1e-30 and 1e-50 are both between 0 and 1.

この質問は閉じられています。

Community Treasure Hunt

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

Start Hunting!

Translated by