Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
concatenating matrix multiplications (or something)

Subject: concatenating matrix multiplications (or something)

From: Richard Wood

Date: 23 Jan, 2009 13:31:02

Message: 1 of 3

Hi,
can someone point me in the direction of the function or name of the following type of multiplication:

I want to multiply all of "a" by "b" elementwise to result in a vector - example should explain clearly:


a =[1,0,0]
b= [1,0,1]
for i=1:size(b,2)
    c(:,i)=[a.*b(i)]';
end
c(:)'

a =

     1 0 0


b =

     1 0 1


ans =

     1 0 0 0 0 0 1 0 0


Thanks!!

Subject: concatenating matrix multiplications (or something)

From: Matt Fig

Date: 23 Jan, 2009 13:43:01

Message: 2 of 3

a =[1,0,0]
b= [1,0,1]
reshape(a'*b,1,[])



%ifafjmm`8cr}__C,c}_}tm_}_W`c_j}K>r}f}smrs_%wengkmk}gnlcalm

Subject: concatenating matrix multiplications (or something)

From: Rich

Date: 23 Jan, 2009 13:59:02

Message: 3 of 3

thanks.
I need to be able to generalise to bigger systems though, so a and b are both arrays:
next level up:
a =[1,0,0;0,0,1]

a =

     1 0 0
     0 0 1

>> b= [1,0;0,1]

b =

     1 0
     0 1

ans =

     1 0 0 1 0 0
     0 0 1 0 0 1

The Kronecker tensor product almost gives what I want, but requires subsequent aggregation, as i want the number of rows to stay constant.

Tags for this Thread

No tags are associated with this thread.

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us