Cody

# Problem 10. Determine whether a vector is monotonically increasing

Solution 204094

Submitted on 14 Feb 2013 by Frank
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));

f = 1 1 1 1 c = Empty matrix: 1-by-0 tf = 1

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

f = Empty matrix: 1-by-0 c = Empty matrix: 1-by-0 tf = 1

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

f = 0 0 0 0 c = 1 2 3 4 tf = 0

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

f = 1 1 1 -7 c = 4 tf = 0

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

f = -1 6 1 1 c = 1 tf = 0

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

f = Columns 1 through 10 0.1000 0.1000 0.1000 0.1000 0.1000 0.1000 0.1000 0.1000 0.1000 0.1000 Columns 11 through 20 0.1000 0.1000 0.1000 0.1000 0.1000 0.1000 0.1000 0.1000 0.1000 0.1000 Columns 21 through 30 0.1000 0.1000 0.1000 0.1000 0.1000 0.1000 0.1000 0.1000 0.1000 0.1000 Columns 31 through 40 0.1000 0.1000 0.1000 0.1000 0.1000 0.1000 0.1000 0.1000 0.1000 0.1000 Columns 41 through 50 0.1000 0.1000 0.1000 0.1000 0.1000 0.1000 0.1000 0.1000 0.1000 0.1000 Columns 51 through 60 0.1000 0.1000 0.1000 0.1000 0.1000 0.1000 0.1000 0.1000 0.1000 0.1000 Columns 61 through 70 0.1000 0.1000 0.1000 0.1000 0.1000 0.1000 0.1000 0.1000 0.1000 0.1000 Columns 71 through 80 0.1000 0.1000 0.1000 0.1000 0.1000 0.1000 0.1000 0.1000 0.1000 0.1000 Columns 81 through 90 0.1000 0.1000 0.1000 0.1000 0.1000 0.1000 0.1000 0.1000 0.1000 0.1000 c = Empty matrix: 1-by-0 tf = 1

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

f = Columns 1 through 10 0.6925 0.5567 0.3965 -2.9337 3.7755 0.3376 0.6079 0.7413 0.1048 0.1279 Columns 11 through 20 0.5495 0.4852 0.8905 0.7990 0.7343 0.0513 0.0729 0.0885 0.7984 0.9430 Columns 21 through 30 0.6837 0.1321 0.7227 0.1104 0.1175 0.6407 0.3288 0.6538 0.7491 0.5832 Columns 31 through 40 0.7400 0.2348 0.7350 0.9706 0.8669 0.0862 0.3664 0.3692 0.6850 0.5979 Columns 41 through 50 0.7894 0.3677 0.2060 0.0867 0.7719 0.2057 0.3883 0.5518 0.2290 0.6419 Columns 51 through 60 0.4845 0.1518 0.7819 0.1006 0.2941 0.2374 0.5309 0.0915 0.4053 0.1048 Columns 61 through 70 0.1123 0.7844 0.2916 0.6035 0.9644 0.4325 0.6948 0.7581 0.4326 0.6555 Columns 71 through 80 0.1098 0.9338 0.1875 0.2662 0.7978 0.4876 0.7690 0.3960 0.2729 0.0372 Columns 81 through 90 0.6733 0.4296 0.4517 0.6099 0.0594 0.3158 0.7727 0.6964 0.1253 0.1302 Columns 91 through 99 0.0924 0.0078 0.4231 0.6556 0.7229 0.5312 0.1088 0.6318 0.1265 c = 4 tf = 0

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

f = Columns 1 through 10 0.0986 0.1420 0.1683 0.1962 0.3175 0.3164 0.2176 0.2510 0.8929 0.7032 Columns 11 through 20 0.5557 0.1844 0.2120 0.0773 0.9138 0.7067 0.5578 0.3134 0.1662 0.6225 Columns 21 through 30 0.9879 0.1704 0.2578 0.3968 0.0740 0.6841 0.4024 0.9828 0.4022 0.6207 Columns 31 through 40 0.1544 0.3813 0.1611 0.7581 0.8711 0.3508 0.6855 0.2941 0.5306 0.8324 Columns 41 through 49 0.5975 0.3353 0.2992 0.4526 0.4226 0.3596 0.5583 0.7425 0.4243 c = Empty matrix: 1-by-0 tf = 1