Cody

# Problem 10. Determine whether a vector is monotonically increasing

Solution 1691998

Submitted on 13 Dec 2018 by D S
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));

differential = 1 1 1 1

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

differential = [] tf = logical 1

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

differential = 0 0 0 0

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

differential = 1 1 1 -7

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

differential = -1 6 1 1

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

differential = Columns 1 through 18 0.1000 0.1000 0.1000 0.1000 0.1000 0.1000 0.1000 0.1000 0.1000 0.1000 0.1000 0.1000 0.1000 0.1000 0.1000 0.1000 0.1000 0.1000 Columns 19 through 36 0.1000 0.1000 0.1000 0.1000 0.1000 0.1000 0.1000 0.1000 0.1000 0.1000 0.1000 0.1000 0.1000 0.1000 0.1000 0.1000 0.1000 0.1000 Columns 37 through 54 0.1000 0.1000 0.1000 0.1000 0.1000 0.1000 0.1000 0.1000 0.1000 0.1000 0.1000 0.1000 0.1000 0.1000 0.1000 0.1000 0.1000 0.1000 Columns 55 through 72 0.1000 0.1000 0.1000 0.1000 0.1000 0.1000 0.1000 0.1000 0.1000 0.1000 0.1000 0.1000 0.1000 0.1000 0.1000 0.1000 0.1000 0.1000 Columns 73 through 90 0.1000 0.1000 0.1000 0.1000 0.1000 0.1000 0.1000 0.1000 0.1000 0.1000 0.1000 0.1000 0.1000 0.1000 0.1000 0.1000 0.1000 0.1000

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

differential = Columns 1 through 18 0.2072 0.6894 0.2918 -2.5770 3.5202 0.2771 0.3441 0.9466 0.1327 0.1782 0.9139 0.1656 0.7700 0.1953 0.6571 0.4150 0.1851 0.0125 Columns 19 through 36 0.8417 0.1530 0.4622 0.5620 0.0289 0.9033 0.2772 0.8417 0.8010 0.8135 0.0903 0.3360 0.6849 1.0000 0.6252 0.2212 0.7556 0.5098 Columns 37 through 54 0.4069 0.9481 0.0429 0.1512 0.8503 0.4550 0.5693 0.9819 0.8793 0.9173 0.8159 0.1747 0.4486 0.6507 0.6750 0.6417 0.2428 0.3226 Columns 55 through 72 0.8104 0.1574 0.4724 0.6137 0.7675 0.5127 0.9414 0.3580 0.7761 0.3481 0.2539 0.0583 0.9707 0.4541 0.1295 0.0388 0.3277 0.9626 Columns 73 through 90 0.8888 0.9622 0.7530 0.0262 0.3463 0.2652 0.8522 0.5504 0.0178 0.6211 0.4801 0.4046 0.1365 0.1869 0.5115 0.1614 0.9712 0.0061 Columns 91 through 99 0.6382 0.0898 0.6657 0.3375 0.8183 0.4872 0.1322 0.3944 0.9725

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

differential = Columns 1 through 18 0.4801 0.2949 0.6073 0.8370 0.6606 0.8606 0.3322 0.0096 0.0158 0.7805 0.8684 0.1218 0.3689 0.8388 0.0471 0.6736 0.9638 0.9284 Columns 19 through 36 0.7975 0.3114 0.3582 0.2671 0.1307 0.1482 0.8954 0.6452 0.8117 0.8234 0.1852 0.5957 0.5317 0.0267 0.9088 0.8146 0.4395 0.1930 Columns 37 through 49 0.8790 0.0479 0.5532 0.1863 0.7133 0.4619 0.5305 0.6670 0.5183 0.0613 0.9043 0.5894 0.8510