Cody

# Problem 10. Determine whether a vector is monotonically increasing

Solution 1809043

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 = -1.0000e+28 y = 0 y = 1 y = 2 y = 3 y = 4

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

tf = logical 1 y = -1.0000e+28 y = 0

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

tf = logical 1 y = -1.0000e+28 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 = -1.0000e+28 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 = -1.0000e+28 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 = -1.0000e+28 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 = -1.0000e+28 y = 0.8536 y = 1.3551 y = 2.2785 y = 3.1278 tf = logical 0 y = -1 y = 4.6468 y = 5.1040 y = 5.3805 y = 5.4843 y = 6.0374 y = 6.7122 y = 6.7180 y = 7.6520 y = 8.4065 y = 8.4376 y = 8.5436 y = 9.3079 y = 9.9143 y = 10.5404 y = 10.9561 y = 11.0568 y = 11.4571 y = 11.4696 y = 11.9875 y = 12.4952 y = 13.2386 y = 14.0176 y = 14.5034 y = 14.6445 y = 15.4986 y = 15.9471 y = 16.1619 y = 16.6469 y = 17.5408 y = 18.2038 y = 19.0837 y = 19.3284 y = 19.9753 y = 20.0887 y = 20.4475 y = 21.4248 y = 21.7829 y = 21.9760 y = 22.0552 y = 22.7480 y = 23.0747 y = 23.3410 y = 24.2778 y = 24.9121 y = 25.6881 y = 25.7596 y = 26.6899 y = 27.0161 y = 27.4633 y = 27.7128 y = 28.1894 y = 29.1790 y = 29.7033 y = 30.4506 y = 31.0152 y = 31.0570 y = 31.3066 y = 32.2510 y = 32.4515 y = 33.0628 y = 33.1479 y = 33.8928 y = 34.0588 y = 35.0090 y = 35.5000 y = 36.0203 y = 36.7549 y = 36.8869 y = 36.9767 y = 37.6194 y = 37.7817 y = 38.4619 y = 38.8701 y = 39.8463 y = 40.1201 y = 40.2653 y = 41.1599 y = 42.0470 y = 42.1829 y = 42.8837 y = 43.7398 y = 44.5150 y = 44.9146 y = 45.1256 y = 45.4627 y = 46.4226 y = 46.6245 y = 46.6486 y = 46.7034 y = 47.4990 y = 47.6641 y = 48.4666 y = 48.4869 y = 48.8099 y = 49.7685

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

tf = logical 1 y = -1.0000e+28 y = 0.2801 y = 0.5873 y = 1.0573 y = 1.5810 y = 2.5159 y = 2.7398 y = 3.3468 y = 3.8661 y = 4.1264 y = 4.4390 y = 4.6801 y = 4.9357 y = 5.3544 y = 5.5714 y = 6.1480 y = 6.7830 y = 7.2968 y = 7.5170 y = 8.3033 y = 8.8312 y = 9.6532 y = 9.6644 y = 9.7297 y = 9.8723 y = 9.8965 y = 10.3436 y = 10.4778 y = 11.4425 y = 12.1371 y = 12.1730 y = 12.2135 y = 12.6949 y = 12.9417 y = 13.2438 y = 14.2374 y = 14.6435 y = 15.3092 y = 15.7542 y = 15.9921 y = 16.4940 y = 17.0082 y = 17.9576 y = 18.6667 y = 18.8971 y = 19.1394 y = 19.1627 y = 19.4203 y = 20.4104 y = 21.0785 y = 21.2164