Thread Subject: element-wise division

Subject: element-wise division

From: Diego Lass

Date: 15 Jun, 2009 20:45:18

Message: 1 of 2

Hi,
Given matrix M1 and vector W, I need to construct a matrix M2.

v1 = [1 2 3 4]
v2 = [5 6 7 8]
v3 = [1 3 4 5]
v4 = [3 4 5 6]

M1 :=
v1*v3' v1*v2'
v2*v4' 0
0 v3*v4
0 0

then we are given a vector W = [w1 w2 w3 w4]'
w1 = 2
w2 = 3
w3 = 4
w4 = 5

we want to construct a matrix M2 most efficiently from W (without loop, use sparse matrix ) such that

M1 ./ M2 =
v1*v3'/(w1*w3) v1*v2'/(w1*w2)
v2*v4'/(w2*w4) 0
0 v3*v4'/(w3*w4)
0 0

Thanks
Diego

Subject: element-wise division

From: Kian

Date: 15 Jun, 2009 21:06:03

Message: 2 of 2

Look up bsxfun. It's only available on 2007a+. You could also download it if you Google "download bsxfun". It does elementwise operations on vectors.

Kian

Tags for this Thread

Everyone's Tags:

Add a New Tag:

Separated by commas
Ex.: root locus, bode

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.

Tag Activity for This Thread
Tag Applied By Date/Time
element wise di... Diego Lass 15 Jun, 2009 16:49:02
rssFeed for this Thread

Contact us at files@mathworks.com