Problem: Given 2 vectors, perform outer product and outer sum between them. The outer operation takes the first element in one vector and performs this operation on each element in the second vector. This results in first row. This is repeated for each of the elements in the first vector. The operation to perform can be any valid operation on these elements.
Matlab Outer product v1=[1 2 3]; v2=[4 5 6]; v1'*v2
|
ans = 4 5 6 8 10 12 12 15 18
|
Outer sum v1=[1 2 3]; v2=[4 5 6]; meshgrid(v1)+meshgrid(v2)'
|
ans = 5 6 7 6 7 8 7 8 9 |