MATLAB Answers


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

calculate matrix from elements of other matrix

1 ビュー (過去 30 日間)
Ilya 2015 年 11 月 19 日
終了済み: Walter Roberson 2015 年 11 月 19 日
Given matrix A = [a(i,j)], what is an efficient and (if possible) concise/readable way to calculate matrix B with elements b(i,j) = a(i,i) - a(i,j)*a(j,i) (or any other such formula)? What currently comes to mind is:
[i, j, ~] = find(A);
b = arrayfun(@(x,y) A(x,x) - A(x,y)*A(y,x), i, j);
b = reshape(b, size(A));

回答 (0 件)

Community Treasure Hunt

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

Start Hunting!

Translated by