Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Solution 85401

Submitted on 3 May 2012

Incorrect

72Size
Leading solution size is 43.
This solution is locked. To view this solution, you need to provide a solution of the same size or smaller.

Test Suite

Test
Code Input and Output
1
Fail
 
%%
t1 = [1 2 3 4 5];
d1 = [2 3 5 6 3];
t2 = [2 3.5 4 4.5 5 6];
d2 = [3 9 8 2 0 1];
[tn,d1n,d2n] = align_time_series(t1,d1,t2,d2);
tnc  = [2 3 3.5 4 4.5 5];
d1nc = [3 5 5.5 6 4.5 3];
d2nc = [3 7 9 8 2 0];
assert(isequal(tn,tnc))
assert(isequal(d1n,d1nc))
assert(isequal(d2n,d2nc))
Error: Assertion failed.
2
Fail
 
%%
t1 = [1 3 5];
d1 = [2 4 2];
t2 = [2 4];
d2 = [1 5];
[tn,d1n,d2n] = align_time_series(t1,d1,t2,d2);
tnc =  [2 3 4];
d1nc = [3 4 3];
d2nc = [1 3 5];
assert(isequal(tn,tnc))
assert(isequal(d1n,d1nc))
assert(isequal(d2n,d2nc))
Error: Assertion failed.
3
Fail
 
%%
t1 = 0:2:20;
d1 = t1.^2 - 12;
t2 = [2 3 5 7 11 13 17 19];
d2 = 4*t2 - 6;
[tn,d1n,d2n] = align_time_series(t1,d1,t2,d2);
tnc =  [2 3 4 5 6 7 8 10 11 12 13 14 16 17 18 19];
d1nc = [-8 -2 4 14 24 38 52 88 110 132 158 184 244 278 312 350];
d2nc = [2 6 10 14 18 22 26 34 38 42 46 50 58 62 66 70];
assert(isequal(tn,tnc))
assert(isequal(d1n,d1nc))
assert(isequal(d2n,d2nc))
Error: Assertion failed.
4
Fail
 
%%
t1 = [1 3 5 6 7 8 9];
d1 = [2 4 2 1 1 1 1];
t2 = [2 4];
d2 = [1 5];
[tn,d1n,d2n] = align_time_series(t1,d1,t2,d2);
tnc =  [2 3 4];
d1nc = [3 4 3];
d2nc = [1 3 5];
assert(isequal(tn,tnc))
assert(isequal(d1n,d1nc))
assert(isequal(d2n,d2nc))
Error: Assertion failed.