Pairwise summation of two vectors?

4 vues (au cours des 30 derniers jours)
Jakub
Jakub le 30 Nov 2014
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

Réponse acceptée

Azzi Abdelmalek
Azzi Abdelmalek le 30 Nov 2014
Modifié(e) : Azzi Abdelmalek le 30 Nov 2014
a=[1 2 3]
b=[4 5 6 7]
c=bsxfun(@plus,a.',b)

Plus de réponses (0)

Catégories

En savoir plus sur MATLAB dans Help Center et File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by