Cody

# Problem 10. Determine whether a vector is monotonically increasing

Solution 517852

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));

x = 0 1 2 3 4

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

x = 0

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

x = 0 0 0 0 0

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

x = 0 1 2 3 -4

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

x = -3 -4 2 3 4

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

x = Columns 1 through 9 1.0000 1.1000 1.2000 1.3000 1.4000 1.5000 1.6000 1.7000 1.8000 Columns 10 through 18 1.9000 2.0000 2.1000 2.2000 2.3000 2.4000 2.5000 2.6000 2.7000 Columns 19 through 27 2.8000 2.9000 3.0000 3.1000 3.2000 3.3000 3.4000 3.5000 3.6000 Columns 28 through 36 3.7000 3.8000 3.9000 4.0000 4.1000 4.2000 4.3000 4.4000 4.5000 Columns 37 through 45 4.6000 4.7000 4.8000 4.9000 5.0000 5.1000 5.2000 5.3000 5.4000 Columns 46 through 54 5.5000 5.6000 5.7000 5.8000 5.9000 6.0000 6.1000 6.2000 6.3000 Columns 55 through 63 6.4000 6.5000 6.6000 6.7000 6.8000 6.9000 7.0000 7.1000 7.2000 Columns 64 through 72 7.3000 7.4000 7.5000 7.6000 7.7000 7.8000 7.9000 8.0000 8.1000 Columns 73 through 81 8.2000 8.3000 8.4000 8.5000 8.6000 8.7000 8.8000 8.9000 9.0000 Columns 82 through 90 9.1000 9.2000 9.3000 9.4000 9.5000 9.6000 9.7000 9.8000 9.9000 Column 91 10.0000

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

x = Columns 1 through 9 0.1089 0.9297 1.2215 1.6685 -1.0000 2.9419 3.5774 3.6756 3.8899 Columns 10 through 18 4.5996 4.7424 5.2269 6.0681 6.5297 6.7085 6.9995 7.4662 8.3603 Columns 19 through 27 8.6255 9.1865 9.8823 10.0457 10.6272 11.3261 11.3819 11.6608 12.2363 Columns 28 through 36 12.8617 13.0806 13.6852 14.2394 14.2920 14.6698 15.1688 16.1542 16.9195 Columns 37 through 45 17.1964 17.4481 18.2111 18.8053 19.5742 19.5785 20.5522 21.4668 21.6739 Columns 46 through 54 21.6851 22.5781 23.3009 24.0892 24.9570 24.9735 25.1584 25.9876 26.8531 Columns 55 through 63 27.4262 27.8895 27.9626 28.9450 29.5612 29.7715 30.0044 30.0988 30.9179 Columns 64 through 72 31.2812 31.9339 32.1762 33.0606 33.6636 34.4085 35.1524 35.5657 36.3231 Columns 73 through 81 37.1660 37.5280 37.7032 37.8338 38.6742 39.1111 39.8117 40.7004 40.9332 Columns 82 through 90 41.1239 41.5979 42.1414 42.9480 43.2111 44.0705 44.2888 45.0163 45.4093 Columns 91 through 99 45.9802 46.5708 47.3829 48.1237 48.2726 48.8025 49.0770 49.4765 50.4534 Column 100 50.9006

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

x = Columns 1 through 9 0.4810 0.5622 0.9342 1.2847 1.9428 2.8810 3.3280 4.2129 4.6181 Columns 10 through 18 5.0792 5.4352 5.4636 6.1726 6.8109 7.2229 7.5929 7.7297 8.5522 Columns 19 through 27 9.4468 9.5707 10.1756 10.8897 11.7603 12.7381 12.9189 13.5356 14.3627 Columns 28 through 36 14.8838 15.6809 16.6615 17.1733 17.5413 17.7635 18.0865 18.6004 18.8740 Columns 37 through 45 19.6671 20.1593 20.5284 20.7678 21.0516 21.9620 22.6089 23.0842 23.5045 Columns 46 through 50 24.5030 25.0886 25.3010 25.8034 26.2227

### Community Treasure Hunt

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

Start Hunting!