0

I have a 3x3 matrix as follows

ls 1 2 3 mic 1 d11 d12 d13 mic 2 d21 d22 d23 mic 3 

where the matrix elements define distance between each component e.g. d11 is the distance between microphone 1 (mic 1) and loudspeaker 1 (ls 1).

each ls has a a specific gain value as follows 3x1

g1 // ls1 g2 // ls2 g3 // ls3 

How would I divide each gain value to the corresponding elements within the distance matrix e.g. g1/d11, g1/d21 and g2/d12 ,g2/d22 etc and then store the values within a results matrix.

thanks

1 Answer 1

3

use bsxfun

res = bsxfun(@rdivide, gain_vec(:)', dist_matrix); 
Sign up to request clarification or add additional context in comments.

3 Comments

it's enough calling just bsxfun(@rdivide, gain_vec', dist_matrix)
@fpe, since the matrix is square I wanted to make sure the division is carried out on the proper dimension - never too careful with these things...
you are right, you posted the answer in the meanwhile I was checking the two ways, asserting that both lead to the same results.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.