Cody

# Problem 10. Determine whether a vector is monotonically increasing

Solution 700855

Submitted on 14 Jul 2015 by Brian
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 ans = []

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

x = 0 ans = []

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

x = 0 0 0 0 0 ans = []

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

x = 0 1 2 3 -4 ans = []

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

x = -3 -4 2 3 4 ans = []

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 ans = []

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

x = Columns 1 through 9 0.1077 0.4507 1.0727 1.8776 -1.0000 2.5838 3.3041 4.0561 4.7880 Columns 10 through 18 5.6141 6.3269 6.5667 6.7203 6.8616 7.8364 7.9622 8.5206 9.0761 Columns 19 through 27 10.0668 10.1122 11.0940 11.7143 12.4677 13.0459 13.0884 13.2184 13.6568 Columns 28 through 36 14.0844 14.4698 14.6067 15.1433 16.0382 16.4537 16.5952 16.6450 17.5845 Columns 37 through 45 17.8304 18.0887 18.4134 18.9084 19.6457 20.0480 20.3276 20.4728 20.6128 Columns 46 through 54 20.6967 21.5537 21.7202 22.6482 22.9852 23.8279 23.9382 24.0498 24.2395 Columns 55 through 63 24.3684 25.0001 25.0553 25.8371 26.1481 26.2096 26.2869 26.5023 26.9808 Columns 64 through 72 27.0877 27.8046 28.6389 29.4238 30.3877 30.4051 31.1128 31.1974 31.5546 Columns 73 through 81 32.0659 32.7143 32.8304 32.9036 32.9736 33.8637 34.5371 34.6968 35.5673 Columns 82 through 90 36.4873 37.3441 37.9612 38.3954 38.5830 38.7215 38.7479 39.0039 39.5420 Columns 91 through 99 40.4974 41.3631 41.9341 41.9385 42.4056 42.8014 43.2962 44.1136 45.0601 Column 100 45.6545 ans = []

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

x = Columns 1 through 9 0.0654 0.1720 0.5144 1.1485 1.7957 2.2125 2.6621 2.9936 3.4225 Columns 10 through 18 3.5279 3.8090 3.9773 4.0843 4.4830 5.0101 5.2346 5.5470 5.9601 Columns 19 through 27 6.1939 6.3180 7.3018 7.5460 7.6011 7.9225 8.5552 9.2444 10.0272 Columns 28 through 36 10.6719 10.6756 11.0786 11.1531 11.6560 12.3605 13.3217 14.1972 14.9554 Columns 37 through 45 15.3474 15.4434 16.0956 16.8883 17.4751 18.2888 18.4651 19.0868 19.6611 Columns 46 through 50 19.7658 19.8023 20.0686 20.4277 20.8540 ans = []