You are on page 1of 1

%test 1

u=[1;2;3;4;5];
v=[4;5;6;7;8];
res_1=myTensor(u,v)

%test 2
u=[1;2;3;4;5;6];
v=[1;2;4;5];
res_2=myTensor(u,v)
%uncomment to chekc myTensor([1;2;3],[4;5])
function t = myTensor(u, v)
t=u*v';
end

res_1 =

4 5 6 7 8
8 10 12 14 16
12 15 18 21 24
16 20 24 28 32
20 25 30 35 40

res_2 =

1 2 4 5
2 4 8 10
3 6 12 15
4 8 16 20
5 10 20 25
6 12 24 30

Published with MATLAB® R2018b

You might also like