MATLAB: Pairwise summation of two vectors

pairwisesum

Is there a way how to do easily pairwise summation between two vectors? Something like pdist but with sum instead of distance. I want to have sum of every number of one vector with every number of second vector. Thanks

Best Answer

a=[1 2 3]
b=[4 5 6 7]
c=bsxfun(@plus,a.',b)
Related Question