Test | Status | Code Input and Output |
---|---|---|
1 | Pass |
% Test to make sure there are no for loops
fid = fopen('interp_v_at_d.m');
text = fread(fid)';
fclose(fid);
assert( isempty( strfind( text, 'for' ) ) )
|
2 | Pass |
% Test to make sure there are no while loops
fid = fopen('interp_v_at_d.m');
text = fread(fid)';
fclose(fid);
assert( isempty( strfind( text, 'while' ) ) )
|
3 | Pass |
% Test to make sure it works
m = 1;
z = cat(3,zeros(m),sort(rand([m,m,10]),3),ones(m));
v = randn([m,m,12]);
d = rand();
v2 = interp_v_at_d(z,v,d);
v2_correct = zeros(m,m);
for i = 1:m
for j = 1:m
v2_correct(i,j) = interp1(squeeze(z(i,j,:)),squeeze(v(i,j,:)),d);
end
end
assert( isequal( v2_correct, v2 ) );
|
4 | Pass |
% Test to make sure it works
m = 5;
z = cat(3,zeros(m),sort(rand([m,m,10]),3),ones(m));
v = randn([m,m,12]);
d = rand();
v2 = interp_v_at_d(z,v,d);
v2_correct = zeros(m,m);
for i = 1:m
for j = 1:m
v2_correct(i,j) = interp1(squeeze(z(i,j,:)),squeeze(v(i,j,:)),d);
end
end
assert( isequal( v2_correct, v2 ) );
|
5 | Pass |
% Test to make sure it works
m = 10;
z = cat(3,zeros(m),sort(rand([m,m,10]),3),ones(m));
v = randn([m,m,12]);
d = rand();
v2 = interp_v_at_d(z,v,d);
v2_correct = zeros(m,m);
for i = 1:m
for j = 1:m
v2_correct(i,j) = interp1(squeeze(z(i,j,:)),squeeze(v(i,j,:)),d);
end
end
assert( isequal( v2_correct, v2 ) );
|
6 | Pass |
% Test to make sure it works
m = 25;
z = cat(3,zeros(m),sort(rand([m,m,10]),3),ones(m));
v = randn([m,m,12]);
d = rand();
v2 = interp_v_at_d(z,v,d);
v2_correct = zeros(m,m);
for i = 1:m
for j = 1:m
v2_correct(i,j) = interp1(squeeze(z(i,j,:)),squeeze(v(i,j,:)),d);
end
end
assert( isequal( v2_correct, v2 ) );
|
7 | Pass |
% Test to make sure it works
m = 100;
z = cat(3,zeros(m),sort(rand([m,m,10]),3),ones(m));
v = randn([m,m,12]);
d = rand();
v2 = interp_v_at_d(z,v,d);
v2_correct = zeros(m,m);
for i = 1:m
for j = 1:m
v2_correct(i,j) = interp1(squeeze(z(i,j,:)),squeeze(v(i,j,:)),d);
end
end
assert( isequal( v2_correct, v2 ) );
|
81 Solvers
235 Solvers
150 Solvers
96 Solvers
277 Solvers
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!