Cody

Problem 10. Determine whether a vector is monotonically increasing

Solution 3360523

Submitted on 24 Oct 2020 by BunnY
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));

tf = logical 1 l = 2 tf = logical 1 l = 3 tf = logical 1 l = 4 tf = logical 1 l = 5

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

tf = logical 1 l = 2 tf = logical 1 l = 3 tf = logical 1 l = 4 tf = logical 0

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

tf = logical 0

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

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

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

tf = logical 1 l = 2 tf = logical 1 l = 3 tf = logical 1 l = 4 tf = logical 0

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

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

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!