matrix multiplication with factor of array matlab -
have matrix have size x y , matrix b x 1
in matrix b have element represent kind of co factor correspondent matrix want program * b ( * factor of each array )
example
a (4 * 3) = [ 2 4 6 ; 5 10 15 ; 7 11 13 ; 1 1 1]; b (4 * 1) = [ 4 ; 1/5 ; 3 ; 7]; want * b [ 2*4 , 4*4 , 6*4 ;5/5 , 10/5 , 15/5 ;7*3 , 11*3 , 13*3 ;1*7 , 1*7 , 1*7]; expected result = [ 8 16 24 ; 1 2 3 ; 21 33 39 ; 7 7 7];
i try use scalar multiplication didn't work since scalar multiplication must have same size of array how solve this?
use bsxfun
desired result of multiplying row elements of a
single row value in b
bsxfun(@times,a,b)
Comments
Post a Comment