Can two 201x1 arrays be added in matrix multiplication way to produce a 201x201 matrix?

I'm having trouble creating a for loop nested in a for loop that allows me to add to single column arrays in a matrix multiplicative way. In other words take two 201x1 arrays add them in the way described below to produce a 201x201 matrix. Please help if you can.
And what I mean by a matrix multiplicative way is :.
A=[1
2
3
4]
B=[A
B
C
D]
A+B=[1+A 2+A 3+A ]
1+B 2+B 3+B
1+C 2+C 3+C
1+D 2+D 3+D....

 Respuesta aceptada

Take a look at bsxfun:
C = bsxfun(@plus, A, B')

2 comentarios

(but switch transpose from B to A to match result in the order posted)

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Loops and Conditional Statements en Centro de ayuda y File Exchange.

Etiquetas

Preguntada:

el 2 de Abr. de 2015

Comentada:

el 3 de Abr. de 2015

Community Treasure Hunt

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

Start Hunting!

Translated by