Cody

# Problem 10. Determine whether a vector is monotonically increasing

Solution 1809044

Submitted on 7 May 2019 by Aseem Gill
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 y = -Inf y = 0 y = 1 y = 2 y = 3 y = 4

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

tf = logical 1 y = -Inf y = 0

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

tf = logical 1 y = -Inf y = 0 tf = logical 0 y = 0 tf = logical 0 y = 0 tf = logical 0 y = 0 tf = logical 0 y = 0

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

tf = logical 1 y = -Inf y = 0 y = 1 y = 2 y = 3 tf = logical 0 y = -4

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

tf = logical 1 y = -Inf y = -3 tf = logical 0 y = -4 y = 2 y = 3 y = 4

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

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

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

tf = logical 1 y = -Inf y = 0.2346 y = 1.0759 y = 1.1020 y = 1.5880 tf = logical 0 y = -1 y = 2.3505 y = 2.8873 y = 3.3913 y = 4.1933 y = 5.0920 y = 6.0773 y = 6.2932 y = 6.2969 y = 6.4730 y = 7.4715 y = 7.6358 y = 8.0362 y = 8.5055 y = 8.7924 y = 9.2549 y = 9.5233 y = 9.8730 y = 10.5394 y = 11.3152 y = 11.9724 y = 12.8518 y = 12.9224 y = 13.2078 y = 14.0194 y = 14.2308 y = 14.6135 y = 15.4753 y = 16.4540 y = 17.4286 y = 17.7869 y = 18.3707 y = 19.0006 y = 19.0707 y = 19.3324 y = 19.6444 y = 20.3758 y = 20.8117 y = 21.2330 y = 21.7984 y = 22.1244 y = 22.9803 y = 23.9099 y = 24.4639 y = 24.9582 y = 25.7939 y = 26.0340 y = 26.7020 y = 27.4235 y = 28.2864 y = 28.7226 y = 28.7731 y = 28.8006 y = 29.6505 y = 30.6480 y = 30.8869 y = 31.2926 y = 31.4208 y = 32.4101 y = 33.3738 y = 33.6619 y = 33.8686 y = 34.3355 y = 34.6484 y = 34.9563 y = 35.7597 y = 36.1608 y = 36.7398 y = 36.9105 y = 37.0476 y = 37.4373 y = 38.1666 y = 38.3049 y = 38.4271 y = 38.5493 y = 39.4684 y = 40.4421 y = 41.2127 y = 41.3594 y = 42.2152 y = 42.8123 y = 43.3689 y = 44.1566 y = 44.9940 y = 45.7533 y = 45.7931 y = 46.7301 y = 47.4109 y = 47.7785 y = 47.9177 y = 48.2249 y = 48.2409 y = 48.9313 y = 49.9029 y = 50.4530 y = 51.2984

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

tf = logical 1 y = -Inf y = 0.2495 y = 1.2011 y = 1.8939 y = 1.9717 y = 2.1200 y = 3.0248 y = 3.6378 y = 4.4564 y = 5.0798 y = 5.5891 y = 5.9936 y = 6.4623 y = 7.3710 y = 7.7543 y = 8.5331 y = 9.4089 y = 10.1371 y = 10.5355 y = 10.6353 y = 11.4631 y = 12.0115 y = 12.1984 y = 12.9739 y = 13.3048 y = 13.9194 y = 14.5780 y = 15.2572 y = 15.2729 y = 15.9147 y = 16.0616 y = 16.9642 y = 17.9348 y = 18.6026 y = 18.6051 y = 19.3204 y = 20.0404 y = 20.6357 y = 21.5945 y = 22.3605 y = 23.1043 y = 23.7320 y = 23.8248 y = 24.7125 y = 24.8719 y = 25.0176 y = 25.5794 y = 25.6627 y = 26.0847 y = 26.9387 y = 27.9010