Really Simple Matrix Multiply Question

1 Ansicht (letzte 30 Tage)
James
James am 3 Dez. 2011
A = [1,5,6,3,2,1] B = [3,4,6]
I want to take each element in A and multiple it by all the elements in B. For example I want C = [3,4,6,15,20,30,18,24...]
I know this is really simple, I'm just missing it in the hlep.
Thanks much,
James

Antworten (2)

Grzegorz Knor
Grzegorz Knor am 3 Dez. 2011
Kronecker tensor product:
kron(A,B)

Paulo Silva
Paulo Silva am 3 Dez. 2011
Yet another possible solution
A = [1,5,6,3,2,1]
B = [3,4,6]
C=cell2mat(arrayfun(@(X)times(A(X),B),1:numel(A),'uni',0))

Kategorien

Mehr zu Startup and Shutdown finden Sie in Help Center und File Exchange

Produkte

Community Treasure Hunt

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

Start Hunting!

Translated by