フィルターのクリア

Adding two different size matrices

4 ビュー (過去 30 日間)
Algorithms Analyst
Algorithms Analyst 2013 年 5 月 14 日
Hi all
I have a one matrice whos size is 100x50 let say
A=ones(100,50)
and I want to add it with its transpose
B=A+A';
but I am getting error of matrix dimensions.
Any help is appreciated..........

採用された回答

John Doe
John Doe 2013 年 5 月 14 日
編集済み: John Doe 2013 年 5 月 14 日
You can't add matrices of different dimensions.
The transpose of A has dimension (50x100)
Think of it:
A =
[1 2
3 4
5 6];
B =
[1 3 5
2 4 6];
What would you want A+B to be?

その他の回答 (1 件)

Andrei Bobrov
Andrei Bobrov 2013 年 5 月 14 日
A=ones(100,50);
A2 = zeros(max(A));
A2(1:numel(A)) = A;
B = A2 + A2';

カテゴリ

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

Community Treasure Hunt

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

Start Hunting!

Translated by