Cody

# Problem 10. Determine whether a vector is monotonically increasing

Solution 228064

Submitted on 8 Apr 2013 by VIVI
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));

lx = 5 counter = 0 counter = 1 counter = 2 counter = 3 counter = 4 tf = 1

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

lx = 1 counter = 0 tf = 1

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

lx = 5 counter = 0 tf = 0 tf = 0 tf = 0 tf = 0

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

lx = 5 counter = 0 counter = 1 counter = 2 counter = 3 tf = 0

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

lx = 5 counter = 0 tf = 0 counter = 1 counter = 2 counter = 3

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

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

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

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

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

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