Summation and array indexes
Ältere Kommentare anzeigen
I am trying to write a function for an optimisation routine that requires the (total) summation of a matrix divided element by element by a second matrix, where the second matrix has a third dimension returning a vector the size of that third dimension.
i.e. something along the lines of a(1:n) = sum(sum(A./B(:,:,1:n))
which doesn't work. Any ideas?
Thanks
2 Kommentare
Adam
am 13 Okt. 2014
Can you give a simple example of inputs A and B?
Akzeptierte Antwort
Weitere Antworten (2)
Roger Stafford
am 14 Okt. 2014
sum(A(:))./sum(sum(B,1),2)
Kategorien
Mehr zu Matrix Indexing finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!