easy beginner question : how to sum up
Afficher commentaires plus anciens
I think this i quite easy for you guys - but ive not found an answer yet (perhaps because my english skills are limitated) I want to summ up two vektors like this V1 = [1 2 3] V2 = V1' (the transposed vektor) and I want to get the ?inner? sum
1 2 3
1
2
3
so that i get a matrix with this relsult ( so just row plus column )
2 3 4
3 4 5
4 5 6
would be really nice if you can help me. thx a lot
2 commentaires
John D'Errico
le 12 Avr 2017
You called this an inner sum. But really, the correct term would be a generalized outer product.
https://en.wikipedia.org/wiki/Outer_product
James Tursa
le 12 Avr 2017
Modifié(e) : James Tursa
le 12 Avr 2017
OP is summing, not multiplying. I.e., an "outer sum" not an "outer product"
Réponse acceptée
Plus de réponses (2)
Guillaume
le 12 Avr 2017
If you're using R2016b or later, simply
V1 + V1.'
In earlier versions
bsxfun(@plus, V1, V1.')
Paul Hoffmann
le 13 Avr 2017
0 votes
Catégories
En savoir plus sur Linear Algebra dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!