This solution is locked. To view this solution, you need to provide a solution of the same size or smaller.
Test | Status | Code Input and Output |
---|---|---|
1 | Pass |
x = [0 1 2 3 4];
assert(isequal(mono_increase(x),true));
y =
1 1 1 1
tf =
logical
1
|
2 | Pass |
x = [0];
assert(isequal(mono_increase(x),true));
y =
[]
tf =
logical
1
|
3 | Pass |
x = [0 0 0 0 0];
assert(isequal(mono_increase(x),false));
y =
0 0 0 0
tf =
logical
0
|
4 | Pass |
x = [0 1 2 3 -4];
assert(isequal(mono_increase(x),false));
y =
1 1 1 -7
tf =
logical
0
|
5 | Pass |
x = [-3 -4 2 3 4];
assert(isequal(mono_increase(x),false));
y =
-1 6 1 1
tf =
logical
0
|
6 | Pass |
x = 1:.1:10;
assert(isequal(mono_increase(x),true));
y =
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
tf =
logical
1
|
7 | Pass |
x = cumsum(rand(1,100));
x(5) = -1;
assert(isequal(mono_increase(x),false));
y =
Columns 1 through 18
0.0150 0.9433 0.6189 -3.1633 4.3082 0.7689 0.6622 0.1505 0.2265 0.4702 0.3397 0.6241 0.2384 0.3141 0.7396 0.0285 0.7360 0.6269
Columns 19 through 36
0.6421 0.4722 0.8591 0.6417 0.9358 0.9128 0.2463 0.9285 0.6433 0.0744 0.1360 0.2462 0.5048 0.5019 0.1616 0.1071 0.3323 0.8668
Columns 37 through 54
0.6066 0.2461 0.2147 0.6820 0.5218 0.8172 0.9836 0.1624 0.9191 0.3884 0.3440 0.1045 0.1700 0.4075 0.2843 0.7112 0.1477 0.3812
Columns 55 through 72
0.0355 0.3258 0.4503 0.3832 0.8767 0.6641 0.8020 0.9237 0.0958 0.8125 0.0145 0.0012 0.7276 0.2303 0.4298 0.1424 0.7748 0.8539
Columns 73 through 90
0.3679 0.6154 0.8242 0.1810 0.1201 0.0464 0.5524 0.3748 0.3487 0.6159 0.4884 0.4252 0.3300 0.4827 0.0033 0.6549 0.3122 0.6825
Columns 91 through 99
0.1252 0.9207 0.1403 0.6311 0.7656 0.9308 0.1952 0.8737 0.5349
tf =
logical
0
|
8 | Pass |
x = cumsum(rand(1,50));
assert(isequal(mono_increase(x),true));
y =
Columns 1 through 18
0.3384 0.8400 0.7296 0.3344 0.6066 0.6673 0.7233 0.2642 0.5160 0.1498 0.2252 0.1599 0.1311 0.3723 0.0903 0.2890 0.5419 0.5189
Columns 19 through 36
0.5381 0.4639 0.2576 0.9571 0.7788 0.8279 0.5319 0.3622 0.6694 0.7649 0.9551 0.1811 0.3568 0.6034 0.2481 0.4273 0.6797 0.5575
Columns 37 through 49
0.0660 0.3390 0.0419 0.0875 0.4477 0.0372 0.8701 0.5800 0.7157 0.0288 0.3202 0.8247 0.8077
tf =
logical
1
|
795 Solvers
153 Solvers
948 Solvers
Create a square matrix of multiples
330 Solvers
Sum the numbers on the main diagonal
375 Solvers