Cody

# Problem 10. Determine whether a vector is monotonically increasing

Solution 517851

Submitted on 29 Oct 2014 by Abhilash
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));

l1 = 5 y1 = 1 1 1 1

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

l1 = 1

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

l1 = 5 y1 = NaN NaN NaN NaN

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

l1 = 5 y1 = 1 1 1 -7

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

l1 = 5 y1 = 1 -6 -1 -1

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

l1 = 91

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

l1 = 100 y1 = Columns 1 through 9 1.0000 1.4329 0.3326 -4.7159 6.7514 0.0208 0.6577 1.5664 0.6509 Columns 10 through 18 0.8215 1.2707 0.1762 0.2472 1.6436 1.4946 0.6942 0.3978 1.5340 Columns 19 through 27 0.7674 0.1238 1.1277 0.9920 0.3555 0.4926 0.7829 0.3217 0.7302 Columns 28 through 36 0.7826 1.4814 0.7207 0.6078 0.1425 0.1530 0.3907 1.1260 1.4899 Columns 37 through 45 1.2227 0.3047 1.5301 0.6824 0.6907 0.4680 0.2808 0.4732 1.1488 Columns 46 through 54 0.1374 0.6554 1.1804 1.3900 1.1022 0.5503 0.4069 0.8865 1.1323 Columns 55 through 63 0.4075 0.9825 0.9094 1.5200 0.7040 0.0553 1.2599 1.0488 0.9234 Columns 64 through 72 0.5149 1.5001 1.4927 0.6158 1.5575 1.5746 0.7024 1.6347 0.8363 Columns 73 through 81 0.0122 1.3903 0.6745 1.3646 1.3140 1.0337 0.1219 0.1006 0.9823 Columns 82 through 90 1.5443 1.1191 0.2831 1.0346 0.2641 0.9679 1.0885 1.3696 0.2024 Columns 91 through 99 0.0194 1.5333 1.2252 1.0294 1.5594 0.1166 0.7462 0.1277 1.2744

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

l1 = 50

### Community Treasure Hunt

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

Start Hunting!