Cody

# Problem 10. Determine whether a vector is monotonically increasing

Solution 2002888

Submitted on 5 Nov 2019 by Nicholas Begg
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));

a = 1 b = 1 a = 2 a = 3 a = 4 a = 5 tf = 1

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

a = 1 b = 1 tf = 1

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

a = 1 b = 1 b = 0 tf = 0

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

a = 1 b = 1 a = 2 a = 3 a = 4 b = 0 tf = 0

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

a = 1 b = 1 b = 0 tf = 0

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

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

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

a = 1 b = 1 a = 2 a = 3 a = 4 b = 0 tf = 0

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

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