Info

Diese Frage ist geschlossen. Öffnen Sie sie erneut, um sie zu bearbeiten oder zu beantworten.

calculate matrix from elements of other matrix

1 Ansicht (letzte 30 Tage)
Ilya
Ilya am 19 Nov. 2015
Geschlossen: Walter Roberson am 19 Nov. 2015
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));

Antworten (0)

Produkte

Community Treasure Hunt

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

Start Hunting!

Translated by