Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

On Matrix Multiplication

Status
Not open for further replies.

HaveQuery

Newbie level 3
Joined
Sep 24, 2011
Messages
3
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,300
Hi,

I have matrix

a = [ 1 2 3 4 5
-1 -2 -3 -4 -5
1 2 3 4 5
-1 -2 -3 -4 -5 ]

and a vector

b = [ 10
20
30
40 ]

I want to multiply the element in each row of b, to corresponding element in each row and every column of a , i.e.

c = [ 1*10 2*10 3*10 4*10 5*10
-1*20 -2*20 -3*20 -4*20 -5*20
1*30 2*30 3*30 4*30 5*30
-1*40 -2*40 -3*40 -4*40 -5*40 ]


Please tell me the best way to implement this using Matrix multiplication.


Finally, I want to sum the contents of each row i.e.

d = [sum(r1,c1:r4,c1) sum(r1,c2:r4,c2) sum(r1,c3:r4,c3)
sum(r1,c4:r4,c4) sum(r1,c5:r4,c5)]


I am currently doing this using element-wise multiplication but that is very slow. I am using Matlab and matrix multiplication will be faster.

I hope that you can suggest a way.

Thanks
 

I have attached a PDF file which contains the same question because the matrices are distorted in the question above. Thanks
 

Attachments

  • q2a - Notepad.pdf
    16.2 KB · Views: 47

...
Finally, I want to sum the contents of each row i.e.

d = [sum(r1,c1:r4,c1) sum(r1,c2:r4,c2) sum(r1,c3:r4,c3)
sum(r1,c4:r4,c4) sum(r1,c5:r4,c5)]
Just do b'*a
ans =
-20 -40 -60 -80 -100
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top