Cody

Solution 2556021

Submitted on 14 Jun 2020
This solution is locked. To view this solution, you need to provide a solution of the same size or smaller.

Test Suite

Test Status Code Input and Output
1   Fail
% 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' ) ) )

Error using fread Invalid file identifier. Use fopen to generate a valid file identifier. Error in Test1 (line 3) text = fread(fid)';

2   Fail
% 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' ) ) )

Error using fread Invalid file identifier. Use fopen to generate a valid file identifier. Error in Test2 (line 3) text = fread(fid)';

3   Fail
% 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 ) );

Undefined function 'interp_v_at_d' for input arguments of type 'double'. Error in Test3 (line 6) v2 = interp_v_at_d(z,v,d);

4   Fail
% 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 ) );

Undefined function 'interp_v_at_d' for input arguments of type 'double'. Error in Test4 (line 6) v2 = interp_v_at_d(z,v,d);

5   Fail
% 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 ) );

Undefined function 'interp_v_at_d' for input arguments of type 'double'. Error in Test5 (line 6) v2 = interp_v_at_d(z,v,d);

6   Fail
% 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 ) );

Undefined function 'interp_v_at_d' for input arguments of type 'double'. Error in Test6 (line 6) v2 = interp_v_at_d(z,v,d);

7   Fail
% 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 ) );

Undefined function 'interp_v_at_d' for input arguments of type 'double'. Error in Test7 (line 6) v2 = interp_v_at_d(z,v,d);