Cody

# Problem 10. Determine whether a vector is monotonically increasing

Solution 1103279

Submitted on 12 Jan 2017 by Matteo Raso
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));

z = 5 counter = 0 tf = logical 1 counter = 1 counter = 2 counter = 3 counter = 4

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

z = 1 counter = 0 tf = logical 1

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

z = 5 counter = 0 tf = logical 1 tf = logical 0

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

z = 5 counter = 0 tf = logical 1 counter = 1 counter = 2 counter = 3 tf = logical 0

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

z = 5 counter = -3 tf = logical 1 tf = logical 0

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

z = 91 counter = 1 tf = logical 1 counter = 1.1000 counter = 1.2000 counter = 1.3000 counter = 1.4000 counter = 1.5000 counter = 1.6000 counter = 1.7000 counter = 1.8000 counter = 1.9000 counter = 2 counter = 2.1000 counter = 2.2000 counter = 2.3000 counter = 2.4000 counter = 2.5000 counter = 2.6000 counter = 2.7000 counter = 2.8000 counter = 2.9000 counter = 3 counter = 3.1000 counter = 3.2000 counter = 3.3000 counter = 3.4000 counter = 3.5000 counter = 3.6000 counter = 3.7000 counter = 3.8000 counter = 3.9000 counter = 4 counter = 4.1000 counter = 4.2000 counter = 4.3000 counter = 4.4000 counter = 4.5000 counter = 4.6000 counter = 4.7000 counter = 4.8000 counter = 4.9000 counter = 5 counter = 5.1000 counter = 5.2000 counter = 5.3000 counter = 5.4000 counter = 5.5000 counter = 5.6000 counter = 5.7000 counter = 5.8000 counter = 5.9000 counter = 6 counter = 6.1000 counter = 6.2000 counter = 6.3000 counter = 6.4000 counter = 6.5000 counter = 6.6000 counter = 6.7000 counter = 6.8000 counter = 6.9000 counter = 7 counter = 7.1000 counter = 7.2000 counter = 7.3000 counter = 7.4000 counter = 7.5000 counter = 7.6000 counter = 7.7000 counter = 7.8000 counter = 7.9000 counter = 8 counter = 8.1000 counter = 8.2000 counter = 8.3000 counter = 8.4000 counter = 8.5000 counter = 8.6000 counter = 8.7000 counter = 8.8000 counter = 8.9000 counter = 9 counter = 9.1000 counter = 9.2000 counter = 9.3000 counter = 9.4000 counter = 9.5000 counter = 9.6000 counter = 9.7000 counter = 9.8000 counter = 9.9000 counter = 10

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

z = 100 counter = 0.8086 tf = logical 1 counter = 1.1629 counter = 2.0562 counter = 2.7964 tf = logical 0

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

z = 50 counter = 0.9684 tf = logical 1 counter = 1.7836 counter = 2.6259 counter = 3.4873 counter = 3.9385 counter = 4.1303 counter = 4.4442 counter = 5.0255 counter = 5.3957 counter = 5.4141 counter = 5.9716 counter = 6.9502 counter = 7.4138 counter = 7.8317 counter = 8.7838 counter = 9.3725 counter = 10.1484 counter = 10.1546 counter = 10.6064 counter = 10.6369 counter = 11.5691 counter = 12.2786 counter = 12.8400 counter = 13.4062 counter = 13.6061 counter = 13.6294 counter = 13.6589 counter = 13.7580 counter = 14.0796 counter = 14.5093 counter = 15.4942 counter = 16.2745 counter = 16.4590 counter = 17.0875 counter = 17.7752 counter = 18.6012 counter = 18.6036 counter = 19.0309 counter = 19.5673 counter = 19.9646 counter = 20.2142 counter = 20.9886 counter = 21.0330 counter = 21.1029 counter = 22.0937 counter = 22.8459 counter = 23.6668 counter = 24.1131 counter = 24.8695 counter = 25.2362