Cody

# Problem 10. Determine whether a vector is monotonically increasing

Solution 1878905

Submitted on 19 Jul 2019 by Thomas Werner
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 a = -1 a = -1 a = -1 a = -1

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

tf = logical 1

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

tf = logical 1 a = 0 tf = logical 0 a = 0 tf = logical 0 a = 0 tf = logical 0 a = 0 tf = logical 0

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

tf = logical 1 a = -1 a = -1 a = -1 a = 7 tf = logical 0

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

tf = logical 1 a = 1 tf = logical 0 a = -6 a = -1 a = -1

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

tf = logical 1 a = -0.1000 a = -0.1000 a = -0.1000 a = -0.1000 a = -0.1000 a = -0.1000 a = -0.1000 a = -0.1000 a = -0.1000 a = -0.1000 a = -0.1000 a = -0.1000 a = -0.1000 a = -0.1000 a = -0.1000 a = -0.1000 a = -0.1000 a = -0.1000 a = -0.1000 a = -0.1000 a = -0.1000 a = -0.1000 a = -0.1000 a = -0.1000 a = -0.1000 a = -0.1000 a = -0.1000 a = -0.1000 a = -0.1000 a = -0.1000 a = -0.1000 a = -0.1000 a = -0.1000 a = -0.1000 a = -0.1000 a = -0.1000 a = -0.1000 a = -0.1000 a = -0.1000 a = -0.1000 a = -0.1000 a = -0.1000 a = -0.1000 a = -0.1000 a = -0.1000 a = -0.1000 a = -0.1000 a = -0.1000 a = -0.1000 a = -0.1000 a = -0.1000 a = -0.1000 a = -0.1000 a = -0.1000 a = -0.1000 a = -0.1000 a = -0.1000 a = -0.1000 a = -0.1000 a = -0.1000 a = -0.1000 a = -0.1000 a = -0.1000 a = -0.1000 a = -0.1000 a = -0.1000 a = -0.1000 a = -0.1000 a = -0.1000 a = -0.1000 a = -0.1000 a = -0.1000 a = -0.1000 a = -0.1000 a = -0.1000 a = -0.1000 a = -0.1000 a = -0.1000 a = -0.1000 a = -0.1000 a = -0.1000 a = -0.1000 a = -0.1000 a = -0.1000 a = -0.1000 a = -0.1000 a = -0.1000 a = -0.1000 a = -0.1000 a = -0.1000

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

tf = logical 1 a = -0.1551 a = -0.1926 a = -0.4692 a = 2.0148 tf = logical 0 a = -3.4041 a = -0.5839 a = -0.8105 a = -0.7265 a = -0.2941 a = -0.9321 a = -0.9161 a = -0.0451 a = -0.4821 a = -0.9501 a = -0.0468 a = -0.9110 a = -0.4467 a = -0.6990 a = -0.9153 a = -0.0238 a = -0.0870 a = -0.1195 a = -0.7230 a = -0.6079 a = -0.6258 a = -0.9764 a = -0.3483 a = -0.6868 a = -0.8745 a = -0.6994 a = -0.8008 a = -0.3127 a = -0.3178 a = -0.0811 a = -0.6761 a = -0.8985 a = -0.9856 a = -0.6079 a = -0.0686 a = -0.9424 a = -0.3732 a = -0.3433 a = -0.1640 a = -0.5238 a = -0.5454 a = -0.1471 a = -0.7555 a = -0.3953 a = -0.3770 a = -0.1441 a = -0.3730 a = -0.0374 a = -0.4258 a = -0.0699 a = -0.5839 a = -0.7310 a = -0.8656 a = -0.7564 a = -0.3147 a = -0.4513 a = -0.0990 a = -0.3148 a = -0.4748 a = -0.3708 a = -0.5980 a = -0.4110 a = -0.3936 a = -0.8155 a = -0.5363 a = -0.2710 a = -0.6263 a = -0.0606 a = -0.0876 a = -0.7983 a = -0.6788 a = -0.5212 a = -0.5317 a = -0.1453 a = -0.7288 a = -0.3344 a = -0.9275 a = -0.6112 a = -0.8619 a = -0.4294 a = -0.0676 a = -0.0363 a = -0.7408 a = -0.8323 a = -0.4924 a = -0.0256 a = -0.6315 a = -0.9627 a = -0.9821 a = -0.4379 a = -0.0084 a = -0.1058 a = -0.0885 a = -0.0614 a = -0.2380

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

tf = logical 1 a = -0.1354 a = -0.1475 a = -0.9338 a = -0.6293 a = -0.8534 a = -0.3883 a = -0.3879 a = -0.4831 a = -0.8712 a = -0.2080 a = -0.6596 a = -0.1606 a = -0.0025 a = -0.1971 a = -0.6681 a = -0.5074 a = -0.6153 a = -0.4029 a = -0.0310 a = -0.5594 a = -0.1079 a = -0.2232 a = -0.1972 a = -0.0374 a = -0.1470 a = -0.2517 a = -0.1491 a = -0.6038 a = -0.6618 a = -0.6573 a = -0.3991 a = -0.2548 a = -0.7287 a = -0.8104 a = -0.7493 a = -0.8898 a = -0.4970 a = -0.2589 a = -0.7980 a = -0.2859 a = -0.8896 a = -0.9218 a = -0.8225 a = -0.1441 a = -0.4107 a = -0.7528 a = -0.4361 a = -0.6569 a = -0.3072