Cody

# Problem 42992. S-T-R-E-T-C-H I-T O-U-T

Solution 1027038

Submitted on 22 Oct 2016 by Alfonso Nieto-Castanon
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
x = [1 5 2 4 3];n=1; y_correct = [1 3 5 3.5 2 3 4 3.5 3]; assert(isequal(stretch_it_out(x,n),y_correct))

2   Pass
x = [1 5 2 4 3];n=2; y_correct=[1 2+1/3 3+2/3 5 4 3 2 2+2/3 3+1/3 4 3+2/3 3+1/3 3]; y=abs(stretch_it_out(x,n)-y_correct); assert(max(y)<1e-9)

3   Pass
k=ceil(5*rand)+1 x=1:k:121 n=k-1; assert(isequal(stretch_it_out(x,n),1:121))

k = 2 x = Columns 1 through 16 1 3 5 7 9 11 13 15 17 19 21 23 25 27 29 31 Columns 17 through 32 33 35 37 39 41 43 45 47 49 51 53 55 57 59 61 63 Columns 33 through 48 65 67 69 71 73 75 77 79 81 83 85 87 89 91 93 95 Columns 49 through 61 97 99 101 103 105 107 109 111 113 115 117 119 121

4   Pass
x=[1 -1 1 -1 1 -1 1];n=3; y_correct=[1 0.5 0 -0.5 -1 -0.5 0 0.5 1 0.5 0 -0.5 -1 -0.5 0 0.5 1 0.5 0 -0.5 -1 -0.5 0 0.5 1]; assert(isequal(stretch_it_out(x,n),y_correct))