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 402202

Submitted on 12 Feb 2014 by Mehmet OZC

Correct

12Size
Leading solution size is 12.
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
Pass
 
%%
p = [1 0 -8 -7 5];
x = [ 5 7 9 ];
y_correct = [ 395  1965  5855];
assert(isequal(polynomial(p,x),y_correct))
ans =
         395        1965        5855
2
Pass
 
%%
p = [1 0 -10 0 0 0 11 -50];
x = [3 7 4 5];
y_correct = [-260  655500  6138 46880]
assert(isequal(polynomial(p,x),y_correct))
y_correct =
        -260      655500        6138       46880
ans =
        -260      655500        6138       46880