Cody

# Problem 10. Determine whether a vector is monotonically increasing

Solution 2657792

Submitted on 6 Jul 2020 by Ze Li Liew
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));

max_x = 1 max_x = 2 max_x = 3 max_x = 4

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

max_x = 1 max_x = 2 max_x = 3

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

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

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

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

max_x = 0.6523 max_x = 0.8430 max_x = 1.5973

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

max_x = 0.9077 max_x = 1.0183 max_x = 1.6030 max_x = 2.1120 max_x = 2.6789 max_x = 3.4451 max_x = 3.9798 max_x = 4.4769 max_x = 5.4488 max_x = 5.5870 max_x = 6.4845 max_x = 7.1434 max_x = 7.7724 max_x = 7.9867 max_x = 8.3130 max_x = 9.2825 max_x = 10.0419 max_x = 10.3013 max_x = 10.3617 max_x = 10.6553 max_x = 11.6333 max_x = 12.3864 max_x = 12.9084 max_x = 13.2852 max_x = 13.9261 max_x = 14.5847 max_x = 15.0747 max_x = 15.2195 max_x = 15.8132 max_x = 15.9448 max_x = 16.1743 max_x = 16.7194 max_x = 16.8308 max_x = 17.2973 max_x = 17.9798 max_x = 18.7313 max_x = 19.7237 max_x = 20.1139 max_x = 20.5758 max_x = 21.2348 max_x = 21.6340 max_x = 21.7291 max_x = 22.2247 max_x = 22.6070 max_x = 23.5214 max_x = 23.5739 max_x = 23.6109 max_x = 23.7400 max_x = 24.4195

### Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!