I have a nx1 vector and a 1xn vector. I want to add them in a special manner like matrix multiplication in an efficient manner (vectorized):
Example:
You can use bsxfun:
A=[1 2 3]' B=[4 5 6] bsxfun(@plus, A, B)
The result is
ans = 5 6 7 6 7 8 7 8 9