Cody

Problem 10. Determine whether a vector is monotonically increasing

Solution 3412588

Submitted on 26 Oct 2020 by Lynette Ramirez
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 = 1 1 1 1

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

x = 1 1 1 -7

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

x = -1 6 1 1

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

x = Columns 1 through 18 0.1000 0.1000 0.1000 0.1000 0.1000 0.1000 0.1000 0.1000 0.1000 0.1000 0.1000 0.1000 0.1000 0.1000 0.1000 0.1000 0.1000 0.1000 Columns 19 through 36 0.1000 0.1000 0.1000 0.1000 0.1000 0.1000 0.1000 0.1000 0.1000 0.1000 0.1000 0.1000 0.1000 0.1000 0.1000 0.1000 0.1000 0.1000 Columns 37 through 54 0.1000 0.1000 0.1000 0.1000 0.1000 0.1000 0.1000 0.1000 0.1000 0.1000 0.1000 0.1000 0.1000 0.1000 0.1000 0.1000 0.1000 0.1000 Columns 55 through 72 0.1000 0.1000 0.1000 0.1000 0.1000 0.1000 0.1000 0.1000 0.1000 0.1000 0.1000 0.1000 0.1000 0.1000 0.1000 0.1000 0.1000 0.1000 Columns 73 through 90 0.1000 0.1000 0.1000 0.1000 0.1000 0.1000 0.1000 0.1000 0.1000 0.1000 0.1000 0.1000 0.1000 0.1000 0.1000 0.1000 0.1000 0.1000

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

x = Columns 1 through 18 0.3970 0.1458 0.8290 -3.1785 3.7015 0.3119 0.0912 0.3727 0.4131 0.4184 0.3451 0.5658 0.6367 0.7299 0.8345 0.3943 0.4402 0.6265 Columns 19 through 36 0.0166 0.9961 0.3140 0.1030 0.3206 0.1431 0.3978 0.5365 0.9584 0.8433 0.0483 0.0606 0.7018 0.7394 0.1009 0.3518 0.6306 0.6983 Columns 37 through 54 0.5851 0.4312 0.3706 0.4403 0.8524 0.2323 0.0229 0.7015 0.4534 0.3435 0.9004 0.3482 0.5958 0.2878 0.2002 0.9191 0.2747 0.9046 Columns 55 through 72 0.5697 0.3798 0.4764 0.7418 0.7068 0.0760 0.8106 0.7862 0.4787 0.7434 0.4356 0.3421 0.1822 0.0364 0.6540 0.3905 0.5830 0.6024 Columns 73 through 90 0.1779 0.9882 0.8572 0.6199 0.4865 0.2226 0.7920 0.4213 0.2229 0.2337 0.0322 0.0368 0.2660 0.3531 0.7393 0.1213 0.3739 0.5921 Columns 91 through 99 0.9923 0.9373 0.0699 0.3568 0.8348 0.5031 0.1932 0.1259 0.0732

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

x = Columns 1 through 18 0.1779 0.4427 0.8229 0.0640 0.9927 0.1167 0.9718 0.3301 0.8294 0.8800 0.8047 0.6430 0.2946 0.2608 0.0410 0.5420 0.0135 0.5922 Columns 19 through 36 0.7678 0.8260 0.8561 0.3042 0.3974 0.9694 0.5044 0.9288 0.6115 0.5824 0.7361 0.0359 0.2241 0.9735 0.7336 0.6897 0.8880 0.2271 Columns 37 through 49 0.9912 0.9641 0.6309 0.1521 0.1265 0.8737 0.5144 0.0518 0.5611 0.8219 0.7916 0.5235 0.3416

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!