Cody

# Problem 10. Determine whether a vector is monotonically increasing

Solution 2097959

Submitted on 19 Jan 2020 by kieran Thompson
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 n = 0 j = 1 n = 1 j = 2 n = 2 j = 3 n = 3 j = 4 n = 4

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

z = 1 n = 0

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

z = 5 n = 0 j = 0 tf = logical 0 n = 0 j = 0 tf = logical 0 n = 0 j = 0 tf = logical 0 n = 0 j = 0 tf = logical 0 n = 0

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

z = 5 n = 0 j = 1 n = 1 j = 2 n = 2 j = 3 n = 3 j = -4 tf = logical 0 n = -4

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

z = 5 n = -3 j = -4 tf = logical 0 n = -4 j = 2 n = 2 j = 3 n = 3 j = 4 n = 4

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

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

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

z = 100 n = 0.2363 j = 0.2567 n = 0.2567 j = 0.7796 n = 0.7796 j = 1.6407 n = 1.6407 j = -1 tf = logical 0 n = -1 j = 2.4598 n = 2.4598 j = 3.2839 n = 3.2839 j = 4.2325 n = 4.2325 j = 5.1869 n = 5.1869 j = 5.5478 n = 5.5478 j = 5.9350 n = 5.9350 j = 6.8095 n = 6.8095 j = 6.9604 n = 6.9604 j = 7.3542 n = 7.3542 j = 8.0575 n = 8.0575 j = 8.2765 n = 8.2765 j = 8.6971 n = 8.6971 j = 8.7022 n = 8.7022 j = 9.6050 n = 9.6050 j = 9.8221 n = 9.8221 j = 10.6441 n = 10.6441 j = 10.8001 n = 10.8001 j = 11.3813 n = 11.3813 j = 12.1353 n = 12.1353 j = 12.6968 n = 12.6968 j = 13.1700 n = 13.1700 j = 13.7077 n = 13.7077 j = 13.8929 n = 13.8929 j = 14.6791 n = 14.6791 j = 15.1905 n = 15.1905 j = 15.3395 n = 15.3395 j = 15.6350 n = 15.6350 j = 16.0594 n = 16.0594 j = 16.1733 n = 16.1733 j = 16.5845 n = 16.5845 j = 16.8551 n = 16.8551 j = 17.5808 n = 17.5808 j = 18.2005 n = 18.2005 j = 18.2362 n = 18.2362 j = 18.9197 n = 18.9197 j = 18.9558 n = 18.9558 j = 19.5539 n = 19.5539 j = 19.7446 n = 19.7446 j = 19.8967 n = 19.8967 j = 20.7698 n = 20.7698 j = 21.0804 n = 21.0804 j = 22.0053 n = 22.0053 j = 22.1411 n = 22.1411 j = 22.6278 n = 22.6278 j = 23.2815 n = 23.2815 j = 23.9323 n = 23.9323 j = 24.1222 n = 24.1222 j = 24.4312 n = 24.4312 j = 24.8190 n = 24.8190 j = 25.3740 n = 25.3740 j = 25.4518 n = 25.4518 j = 25.6331 n = 25.6331 j = 26.6308 n = 26.6308 j = 27.5577 n = 27.5577 j = 27.7596 n = 27.7596 j = 28.3937 n = 28.3937 j = 29.3770 n = 29.3770 j = 29.8145 n = 29.8145 j = 30.3225 n = 30.3225 j = 31.1683 n = 31.1683 j = 31.6044 n = 31.6044 j = 32.2175 n = 32.2175 j = 33.1163 n = 33.1163 j = 33.5135 n = 33.5135 j = 33.6706 n = 33.6706 j = 33.8435 n = 33.8435 j = 34.6427 n = 34.6427 j = 34.7183 n = 34.7183 j = 35.6998 n = 35.6998 j = 36.5677 n = 36.5677 j = 37.0423 n = 37.0423 j = 37.7692 n = 37.7692 j = 38.3889 n = 38.3889 j = 38.8057 n = 38.8057 j = 39.6432 n = 39.6432 j = 39.9595 n = 39.9595 j = 40.3174 n = 40.3174 j = 40.3832 n = 40.3832 j = 40.5173 n = 40.5173 j = 40.7116 n = 40.7116 j = 41.5293 n = 41.5293 j = 41.8331 n = 41.8331 j = 42.4207 n = 42.4207 j = 43.0826 n = 43.0826 j = 43.9634 n = 43.9634 j = 44.6012 n = 44.6012 j = 44.7379 n = 44.7379 j = 45.6009 n = 45.6009 j = 45.6424 n = 45.6424 j = 45.8637 n = 45.8637 j = 46.1601 n = 46.1601 j = 46.8433 n = 46.8433 j = 47.1937 n = 47.1937 j = 47.5376 n = 47.5376 j = 48.3359 n = 48.3359

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

z = 50 n = 0.9579 j = 1.6604 n = 1.6604 j = 1.9579 n = 1.9579 j = 2.5508 n = 2.5508 j = 2.8163 n = 2.8163 j = 3.4251 n = 3.4251 j = 3.7907 n = 3.7907 j = 4.1780 n = 4.1780 j = 4.7701 n = 4.7701 j = 5.5780 n = 5.5780 j = 6.3347 n = 6.3347 j = 6.9135 n = 6.9135 j = 7.8603 n = 7.8603 j = 8.3137 n = 8.3137 j = 8.3429 n = 8.3429 j = 9.0896 n = 9.0896 j = 9.1291 n = 9.1291 j = 10.0139 n = 10.0139 j = 10.1455 n = 10.1455 j = 10.4443 n = 10.4443 j = 11.1610 n = 11.1610 j = 11.9105 n = 11.9105 j = 12.6161 n = 12.6161 j = 13.0311 n = 13.0311 j = 13.3082 n = 13.3082 j = 13.5859 n = 13.5859 j = 13.9218 n = 13.9218 j = 14.4773 n = 14.4773 j = 14.7258 n = 14.7258 j = 14.9986 n = 14.9986 j = 15.8612 n = 15.8612 j = 16.6658 n = 16.6658 j = 17.2503 n = 17.2503 j = 17.6411 n = 17.6411 j = 18.5855 n = 18.5855 j = 19.4253 n = 19.4253 j = 19.9443 n = 19.9443 j = 20.3203 n = 20.3203 j = 20.5726 n = 20.5726 j = 21.4271 n = 21.4271 j = 21.4643 n = 21.4643 j = 21.8379 n = 21.8379 j = 22.5997 n = 22.5997 j = 23.1334 n = 23.1334 j = 23.5828 n = 23.5828 j = 23.6593 n = 23.6593 j = 23.7329 n = 23.7329 j = 23.9336 n = 23.9336 j = 24.6221 n = 24.6221 j = 24.7026 n = 24.7026