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:
Multiplying the corresponding elements of a matrix

Subject: Multiplying the corresponding elements of a matrix

From: Anu

Date: 24 Jun, 2009 00:32:01

Message: 1 of 3

Hi,
 I have two matrices [ MxN ]. I would like to multiply the corresponding elements Ai,j x Bi,j and get the final matrix Ci,j. How do I go about doing that.
Thanks

Subject: Multiplying the corresponding elements of a matrix

From: James Tursa

Date: 24 Jun, 2009 00:38:01

Message: 2 of 3

"Anu " <arosta@rediffmail.com> wrote in message <h1rs61$rqh$1@fred.mathworks.com>...
> Hi,
> I have two matrices [ MxN ]. I would like to multiply the corresponding elements Ai,j x Bi,j and get the final matrix Ci,j. How do I go about doing that.
> Thanks

A .* B

James Tursa

Subject: Multiplying the corresponding elements of a matrix

From: Faraz Afzal

Date: 24 Jun, 2009 00:54:01

Message: 3 of 3

Dear Anu,

This is how you do it..

C = A .* B

And now you have your C matrix with corresponding element multiplication.

e.g.
A = [1 2 ; 3 4]
B = [1 2 ; 3 4]

and then use
C = A .* B
and u will see

C =

     1 4
     9 16
 
Dont forget to say thanks if it worked. :o)

Regards,
Muhammad Faraz

"Anu " <arosta@rediffmail.com> wrote in message <h1rs61$rqh$1@fred.mathworks.com>...
> Hi,
> I have two matrices [ MxN ]. I would like to multiply the corresponding elements Ai,j x Bi,j and get the final matrix Ci,j. How do I go about doing that.
> Thanks

Tags for 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