multiplying multiple values inside multiple matrices
Ältere Kommentare anzeigen
Hello,
I have multiple matrices (all quite large, of equal size) that all need to be multiplied into a final matrix. For example, if I have a matrix [2, 2] and another [3, 2], I need to find a way to multiply these two to obtain [6, 4]. The trick being that each matrix value is multiplied by the corresponding value in the same location in all the other matrices.
Thanks
1 Kommentar
Azzi Abdelmalek
am 24 Sep. 2013
Bearbeitet: Azzi Abdelmalek
am 24 Sep. 2013
If
A=[1 2;3 4]
B=[1 2;3 4;5 6]
What is the expected result?
Akzeptierte Antwort
Weitere Antworten (1)
Azzi Abdelmalek
am 24 Sep. 2013
Maybe this is what you want
A=[1 2;3 4]
B=[1 2;3 4;5 6]
out=cell2mat(arrayfun(@(x) x*B,A,'un',0))
3 Kommentare
Azzi Abdelmalek
am 24 Sep. 2013
I gave an example, what is the expected result?
Image Analyst
am 24 Sep. 2013
Your example did not fit his requirement of "of equal size".
Azzi Abdelmalek
am 24 Sep. 2013
I took [2, 2] , [3, 2] for the sizes
Kategorien
Mehr zu Creating and Concatenating Matrices 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!