MATLAB: Can you help me solving that

matrices

A=[1 2 3 4 5 6 7 8 9 10]
B=[a b c d e f ]
I want to create such a matrix as a result:
C[1+a 1+b 1+c 1+d 1+e 1+f ; 2+a … 2+f ; 3+a… 3+f; ……;10+a…10+f]
A is 1×10 and B is 1×6 sized matrices. C is 10×6 sized matrix.
Thank you for your help!

Best Answer

  • How about:
    A = [1 2 3 4 5 6];
    b = [1 2 3];
    C = zeros(size(A'*b));
    for ii = 1:length(A)
    C(ii,:) = b + A(ii);
    end