Cody

# Problem 42320. Write a function man that takes a row vector v and returns a matrix H as follows..

Solution 1658776

Submitted on 25 Oct 2018 by Valentin Neis
This solution is locked. To view this solution, you need to provide a solution of the same size or smaller.

### Test Suite

Test Status Code Input and Output
1   Pass
v = 0; H = [0 0 0]; assert(isequal(man(v),H))

H = 1 1 1 H = 0 1 1 H = 0 0 1 H = 0 0 0

2   Pass
v = [1 4]; H = [1 1 1;4 16 64]; assert(isequal(man(v),H))

H = 1 1 1 1 1 1 H = 1 1 1 4 1 1 H = 1 1 1 4 1 1 H = 1 1 1 4 16 1 H = 1 1 1 4 16 1 H = 1 1 1 4 16 64

3   Pass
v = [1 2 3]; H = [ 1 1 1;2 4 8; 3 9 27]; assert(isequal(man(v),H))

H = 1 1 1 1 1 1 1 1 1 H = 1 1 1 2 1 1 3 1 1 H = 1 1 1 2 1 1 3 1 1 H = 1 1 1 2 4 1 3 1 1 H = 1 1 1 2 4 1 3 9 1 H = 1 1 1 2 4 1 3 9 1 H = 1 1 1 2 4 8 3 9 1 H = 1 1 1 2 4 8 3 9 27

4   Pass
v =[2 7 5 1 6 5 1 1 7 9 8 3 8 2 8 4 1 9]; H = [2 4 8;7 49 343;5 25 125;1 1 1;6 36 216;5 25 125;1 1 1;1 1 1;7 49 343;9 81 729;8 64 512;3 9 27;8 64 512;2 4 8;8 64 512;4 16 64;1 1 1;9 81 729]; assert(isequal(man(v),H))

H = 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 H = 2 1 1 7 1 1 5 1 1 1 1 1 6 1 1 5 1 1 1 1 1 1 1 1 7 1 1 9 1 1 8 1 1 3 1 1 8 1 1 2 1 1 8 1 1 4 1 1 1 1 1 9 1 1 H = 2 4 1 7 1 1 5 1 1 1 1 1 6 1 1 5 1 1 1 1 1 1 1 1 7 1 1 9 1 1 8 1 1 3 1 1 8 1 1 2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1 1 1 6 36 1 5 25 1 1 1 1 1 1 1 7 49 1 9 81 1 8 64 1 3 9 1 8 64 1 2 4 1 8 64 1 4 16 1 1 1 1 9 81 1 H = 2 4 8 7 49 343 5 25 125 1 1 1 6 36 1 5 25 1 1 1 1 1 1 1 7 49 1 9 81 1 8 64 1 3 9 1 8 64 1 2 4 1 8 64 1 4 16 1 1 1 1 9 81 1 H = 2 4 8 7 49 343 5 25 125 1 1 1 6 36 1 5 25 1 1 1 1 1 1 1 7 49 1 9 81 1 8 64 1 3 9 1 8 64 1 2 4 1 8 64 1 4 16 1 1 1 1 9 81 1 H = 2 4 8 7 49 343 5 25 125 1 1 1 6 36 216 5 25 1 1 1 1 1 1 1 7 49 1 9 81 1 8 64 1 3 9 1 8 64 1 2 4 1 8 64 1 4 16 1 1 1 1 9 81 1 H = 2 4 8 7 49 343 5 25 125 1 1 1 6 36 216 5 25 125 1 1 1 1 1 1 7 49 1 9 81 1 8 64 1 3 9 1 8 64 1 2 4 1 8 64 1 4 16 1 1 1 1 9 81 1 H = 2 4 8 7 49 343 5 25 125 1 1 1 6 36 216 5 25 125 1 1 1 1 1 1 7 49 1 9 81 1 8 64 1 3 9 1 8 64 1 2 4 1 8 64 1 4 16 1 1 1 1 9 81 1 H = 2 4 8 7 49 343 5 25 125 1 1 1 6 36 216 5 25 125 1 1 1 1 1 1 7 49 1 9 81 1 8 64 1 3 9 1 8 64 1 2 4 1 8 64 1 4 16 1 1 1 1 9 81 1 H = 2 4 8 7 49 343 5 25 125 1 1 1 6 36 216 5 25 125 1 1 1 1 1 1 7 49 343 9 81 1 8 64 1 3 9 ...