use bsxfunbsxfun:
A = [ 1 2 3 ;4 5; 1 2 3 ;4 5; 1 2 3 ; 4 5 ]; 1 2 3 ]; B = [ 1 ; 10 ; 100 ; 1000 ];10000]; C = bsxfun(@times,A,B) returns:
C = 1 20 2 300 3 4000 50000 10 1 20 300 30 4000 100 50000 200 1 300 100020 2000 300 3000 4000 50000 Works the same for A' with B'
so for your case:
temp = bsxfun(@times,p_c_w,p_w)