Test Suite has been corrupted. Output from my code is merely echoing the input in each case, which doesn't match the intended input.
Test | Status | Code Input and Output |
---|---|---|
1 | Fail |
x = [ 0 1 ; 2 3 ] ;
timer=tic;
y = remove_average_vectorized(x);
duration=toc(timer)
% You can probably pass this test with a for loop.
assert(duration<0.1,sprintf('Time used %2.3f\n',duration));
y =
0 1
2 3
|
2 | Fail |
x = [ 1:9999 ; 2:10000 ; [ zeros(1,9998) 9999 ] ];
x = repmat(x,1000,1);
y_correct = [ -4999:1:4999 ; -4999:1:4999 ; [ repmat(-1,1,9998) 9998 ] ];
y_correct = repmat(y_correct,1000,1);
y = remove_average_vectorized(x);
assert(isequal(y,y_correct));
y =
0 1
2 3
|
3 | Fail |
x = [ 1:9999 ; 2:10000 ; [ zeros(1,9998) 9999 ] ];
x = repmat(x,1000,1);
timer=tic;
y = remove_average_vectorized(x);
duration=toc(timer)
% A decent vectorized solution should take around 1 second.
assert(duration<2,sprintf('Time used %2.3f\n',duration));
y =
0 1
2 3
|
1159 Solvers
Back to basics 6 - Column Vector
908 Solvers
Check if number exists in vector
4465 Solvers
3063 Solvers
358 Solvers
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!