How I compute multiple sum in matlab for 4D matrix?
2 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
How I compute multiple sum in matlab for 4D matrices as below? U and V are 4D matrices.
12 Commenti
Risposte (1)
Matt J
il 11 Set 2018
Modificato: Matt J
il 11 Set 2018
Notice that the only indices shared between U and V are j and q. Therefore, you can minimize multiplication operations as follows,
partialU=sum(sum(U,4),1); %sum over i and r
partialV=sum(sum(V,4),1); %sum over k and s
A=sum(partialU(:).*partialV(:)); %sum over j and q
6 Commenti
Matt J
il 11 Set 2018
Modificato: Matt J
il 11 Set 2018
You should edit your original post with this new equation and information about q_r and q_s. The new expression is rather unclear. You have the symbol q being used for two different things, both as a symbolic variable and as an index of summation.
Vedere anche
Categorie
Scopri di più su Matrix Indexing in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!