Cody

# Problem 44083. First use of arrayfun() and anonymous function @(x)

Solution 1567977

Submitted on 23 Jun 2018
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
A = [0 1 2]; s = [1 2 3]; y_correct = [3 6 11]; assert(isequal(parabola_equation(A,s),y_correct))

Error using vertcat Dimensions of arrays being concatenated are not consistent. Error in parabola_equation (line 4) y = s * [A.^2; A; 1] Error in Test1 (line 4) assert(isequal(parabola_equation(A,s),y_correct))

2   Fail
A = -12:4:11; s = [-5 -8 0]; y_correct = [-624 -256 -48 0 -112 -384]; assert(isequal(parabola_equation(A,s),y_correct))

Error using vertcat Dimensions of arrays being concatenated are not consistent. Error in parabola_equation (line 4) y = s * [A.^2; A; 1] Error in Test2 (line 4) assert(isequal(parabola_equation(A,s),y_correct))

3   Fail
A = -2:2; s = [0 pi 0]; y_correct = [-2*pi -pi 0 pi 2*pi]; assert(isequal(parabola_equation(A,s),y_correct))

Error using vertcat Dimensions of arrays being concatenated are not consistent. Error in parabola_equation (line 4) y = s * [A.^2; A; 1] Error in Test3 (line 4) assert(isequal(parabola_equation(A,s),y_correct))

4   Pass
assert(isempty(regexp(evalc('type parabola_equation'),'(eval|for|while|)')))

5   Fail
assert(not(isempty(regexp(evalc('type parabola_equation'),'(@)'))))

Assertion failed.

6   Fail
assert(not(isempty(regexp(evalc('type parabola_equation'),'arrayfun'))))

Assertion failed.