Cody

Problem 10. Determine whether a vector is monotonically increasing

Solution 443991

Submitted on 20 May 2014 by Jörg
This solution is locked. To view this solution, you need to provide a solution of the same size or smaller.

This solution is outdated. To rescore this solution, sign in.

Test Suite

Test Status Code Input and Output
1   Pass
%% x = [0 1 2 3 4]; assert(isequal(mono_increase(x),true));

x = 1 1 1 1

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

x = []

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

x = 0 0 0 0

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

x = 1 1 1 -7

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

x = -1 6 1 1

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

x = Columns 1 through 9 0.1000 0.1000 0.1000 0.1000 0.1000 0.1000 0.1000 0.1000 0.1000 Columns 10 through 18 0.1000 0.1000 0.1000 0.1000 0.1000 0.1000 0.1000 0.1000 0.1000 Columns 19 through 27 0.1000 0.1000 0.1000 0.1000 0.1000 0.1000 0.1000 0.1000 0.1000 Columns 28 through 36 0.1000 0.1000 0.1000 0.1000 0.1000 0.1000 0.1000 0.1000 0.1000 Columns 37 through 45 0.1000 0.1000 0.1000 0.1000 0.1000 0.1000 0.1000 0.1000 0.1000 Columns 46 through 54 0.1000 0.1000 0.1000 0.1000 0.1000 0.1000 0.1000 0.1000 0.1000 Columns 55 through 63 0.1000 0.1000 0.1000 0.1000 0.1000 0.1000 0.1000 0.1000 0.1000 Columns 64 through 72 0.1000 0.1000 0.1000 0.1000 0.1000 0.1000 0.1000 0.1000 0.1000 Columns 73 through 81 0.1000 0.1000 0.1000 0.1000 0.1000 0.1000 0.1000 0.1000 0.1000 Columns 82 through 90 0.1000 0.1000 0.1000 0.1000 0.1000 0.1000 0.1000 0.1000 0.1000

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

x = Columns 1 through 9 0.1302 0.0924 0.0078 -1.3557 2.4343 0.7229 0.5312 0.1088 0.6318 Columns 10 through 18 0.1265 0.1343 0.0986 0.1420 0.1683 0.1962 0.3175 0.3164 0.2176 Columns 19 through 27 0.2510 0.8929 0.7032 0.5557 0.1844 0.2120 0.0773 0.9138 0.7067 Columns 28 through 36 0.5578 0.3134 0.1662 0.6225 0.9879 0.1704 0.2578 0.3968 0.0740 Columns 37 through 45 0.6841 0.4024 0.9828 0.4022 0.6207 0.1544 0.3813 0.1611 0.7581 Columns 46 through 54 0.8711 0.3508 0.6855 0.2941 0.5306 0.8324 0.5975 0.3353 0.2992 Columns 55 through 63 0.4526 0.4226 0.3596 0.5583 0.7425 0.4243 0.4294 0.1249 0.0244 Columns 64 through 72 0.2902 0.3175 0.6537 0.9569 0.9357 0.4579 0.2405 0.7639 0.7593 Columns 73 through 81 0.7406 0.7437 0.1059 0.6816 0.4633 0.2122 0.0985 0.8236 0.1750 Columns 82 through 90 0.1636 0.6660 0.8944 0.5166 0.7027 0.1536 0.9535 0.5409 0.6797 Columns 91 through 99 0.0366 0.8092 0.7486 0.1202 0.5250 0.3258 0.5464 0.3989 0.4151

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

x = Columns 1 through 9 0.2554 0.0205 0.9237 0.6537 0.9326 0.1635 0.9211 0.7947 0.5774 Columns 10 through 18 0.4400 0.2576 0.7519 0.2287 0.0642 0.7673 0.6712 0.7152 0.6421 Columns 19 through 27 0.4190 0.3908 0.8161 0.3174 0.8145 0.7891 0.8523 0.5056 0.6357 Columns 28 through 36 0.9509 0.4440 0.0600 0.8667 0.6312 0.3551 0.9970 0.2242 0.6525 Columns 37 through 45 0.6050 0.3872 0.1422 0.0251 0.4211 0.1841 0.7258 0.3704 0.8416 Columns 46 through 49 0.7342 0.5710 0.1769 0.9574

Suggested Problems

More from this Author95

Community Treasure Hunt

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

Start Hunting!