Cody

# Problem 10. Determine whether a vector is monotonically increasing

Solution 1195171

Submitted on 22 May 2017 by Karen Yee
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 = [0 1 2 3 4]; assert(isequal(mono_increase(x),true));

i = 1 i = 2 tf = 1 i = 3 tf = 1 i = 4 tf = 1 i = 5 tf = 1

2   Pass
x = [0]; assert(isequal(mono_increase(x),true));

i = 1 tf = 1

3   Pass
x = [0 0 0 0 0]; assert(isequal(mono_increase(x),false));

i = 1 i = 2 tf = 0

4   Pass
x = [0 1 2 3 -4]; assert(isequal(mono_increase(x),false));

i = 1 i = 2 tf = 1 i = 3 tf = 1 i = 4 tf = 1 i = 5 tf = 0

5   Pass
x = [-3 -4 2 3 4]; assert(isequal(mono_increase(x),false));

i = 1 i = 2 tf = 0

6   Pass
x = 1:.1:10; assert(isequal(mono_increase(x),true));

i = 1 i = 2 tf = 1 i = 3 tf = 1 i = 4 tf = 1 i = 5 tf = 1 i = 6 tf = 1 i = 7 tf = 1 i = 8 tf = 1 i = 9 tf = 1 i = 10 tf = 1 i = 11 tf = 1 i = 12 tf = 1 i = 13 tf = 1 i = 14 tf = 1 i = 15 tf = 1 i = 16 tf = 1 i = 17 tf = 1 i = 18 tf = 1 i = 19 tf = 1 i = 20 tf = 1 i = 21 tf = 1 i = 22 tf = 1 i = 23 tf = 1 i = 24 tf = 1 i = 25 tf = 1 i = 26 tf = 1 i = 27 tf = 1 i = 28 tf = 1 i = 29 tf = 1 i = 30 tf = 1 i = 31 tf = 1 i = 32 tf = 1 i = 33 tf = 1 i = 34 tf = 1 i = 35 tf = 1 i = 36 tf = 1 i = 37 tf = 1 i = 38 tf = 1 i = 39 tf = 1 i = 40 tf = 1 i = 41 tf = 1 i = 42 tf = 1 i = 43 tf = 1 i = 44 tf = 1 i = 45 tf = 1 i = 46 tf = 1 i = 47 tf = 1 i = 48 tf = 1 i = 49 tf = 1 i = 50 tf = 1 i = 51 tf = 1 i = 52 tf = 1 i = 53 tf = 1 i = 54 tf = 1 i = 55 tf = 1 i = 56 tf = 1 i = 57 tf = 1 i = 58 tf = 1 i = 59 tf = 1 i = 60 tf = 1 i = 61 tf = 1 i = 62 tf = 1 i = 63 tf = 1 i = 64 tf = 1 i = 65 tf = 1 i = 66 tf = 1 i = 67 tf = 1 i = 68 tf = 1 i = 69 tf = 1 i = 70 tf = 1 i = 71 tf = 1 i = 72 tf = 1 i = 73 tf = 1 i = 74 tf = 1 i = 75 tf = 1 i = 76 tf = 1 i = 77 tf = 1 i = 78 tf = 1 i = 79 tf = 1 i = 80 tf = 1 i = 81 tf = 1 i = 82 tf = 1 i = 83 tf = 1 i = 84 tf = 1 i = 85 tf = 1 i = 86 tf = 1 i = 87 tf = 1 i = 88 tf = 1 i = 89 tf = 1 i = 90 tf = 1 i = 91 tf = 1

7   Pass
x = cumsum(rand(1,100)); x(5) = -1; assert(isequal(mono_increase(x),false));

i = 1 i = 2 tf = 1 i = 3 tf = 1 i = 4 tf = 1 i = 5 tf = 0

8   Pass
x = cumsum(rand(1,50)); assert(isequal(mono_increase(x),true));

i = 1 i = 2 tf = 1 i = 3 tf = 1 i = 4 tf = 1 i = 5 tf = 1 i = 6 tf = 1 i = 7 tf = 1 i = 8 tf = 1 i = 9 tf = 1 i = 10 tf = 1 i = 11 tf = 1 i = 12 tf = 1 i = 13 tf = 1 i = 14 tf = 1 i = 15 tf = 1 i = 16 tf = 1 i = 17 tf = 1 i = 18 tf = 1 i = 19 tf = 1 i = 20 tf = 1 i = 21 tf = 1 i = 22 tf = 1 i = 23 tf = 1 i = 24 tf = 1 i = 25 tf = 1 i = 26 tf = 1 i = 27 tf = 1 i = 28 tf = 1 i = 29 tf = 1 i = 30 tf = 1 i = 31 tf = 1 i = 32 tf = 1 i = 33 tf = 1 i = 34 tf = 1 i = 35 tf = 1 i = 36 tf = 1 i = 37 tf = 1 i = 38 tf = 1 i = 39 tf = 1 i = 40 tf = 1 i = 41 tf = 1 i = 42 tf = 1 i = 43 tf = 1 i = 44 tf = 1 i = 45 tf = 1 i = 46 tf = 1 i = 47 tf = 1 i = 48 tf = 1 i = 49 tf = 1 i = 50 tf = 1