Test | Status | Code Input and Output |
---|---|---|
1 | Pass |
x = [1 5 2 4 3];n=1;
y_correct = [1 3 5 3.5 2 3 4 3.5 3];
assert(isequal(stretch_it_out(x,n),y_correct))
|
2 | Pass |
x = [1 5 2 4 3];n=2;
y_correct=[1 2+1/3 3+2/3 5 4 3 2 2+2/3 3+1/3 4 3+2/3 3+1/3 3];
y=abs(stretch_it_out(x,n)-y_correct);
assert(max(y)<1e-9)
|
3 | Pass |
k=ceil(5*rand)+1
x=1:k:121
n=k-1;
assert(isequal(stretch_it_out(x,n),1:121))
k =
5
x =
Columns 1 through 16
1 6 11 16 21 26 31 36 41 46 51 56 61 66 71 76
Columns 17 through 25
81 86 91 96 101 106 111 116 121
|
4 | Pass |
x=[1 -1 1 -1 1 -1 1];n=3;
y_correct=[1 0.5 0 -0.5 -1 -0.5 0 0.5 1 0.5 0 -0.5 -1 -0.5 0 0.5 1 0.5 0 -0.5 -1 -0.5 0 0.5 1];
assert(isequal(stretch_it_out(x,n),y_correct))
|
2261 Solvers
Back to basics 23 - Triangular matrix
634 Solvers
Create a matrix X, where each column is a shifted copy of the vector v
142 Solvers
Split a string into chunks of specified length
475 Solvers
509 Solvers
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!