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....

 채택된 답변

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

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Loops and Conditional Statements에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by