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

Learn moreOpportunities for recent engineering grads.

Apply TodayCorrect

39Size

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

Test

Code Input and Output

1

Pass

%% assert(isequal(guess_the_coefficients(@(x)x^2+2*x+15),[1 2 15]))

a = 1 2 3 4 5 6 7 8 9 10 b = 18 23 30 39 50 63 78 95 114 135 [Warning: Polynomial is badly conditioned. Add points with distinct X values, reduce the degree of the polynomial, or try centering and scaling as described in HELP POLYFIT.] [> In polyfit at 76 In guess_the_coefficients at 4 In verifyCode>evaluateCode at 226 In verifyCode at 40 In fevalJSON at 14] c = 0 0 0 0 0 0 0 1 2 15 ans = 1 2 15

2

Pass

%% assert(isequal(guess_the_coefficients(@(x)polyval(53,x)),53))

a = 1 2 3 4 5 6 7 8 9 10 b = 53 53 53 53 53 53 53 53 53 53 [Warning: Polynomial is badly conditioned. Add points with distinct X values, reduce the degree of the polynomial, or try centering and scaling as described in HELP POLYFIT.] [> In polyfit at 76 In guess_the_coefficients at 4 In verifyCode>evaluateCode at 226 In verifyCode at 40 In fevalJSON at 14] c = 0 0 0 0 0 0 0 0 0 53 ans = 53

3

Pass

%% assert(isequal(guess_the_coefficients(@(x)polyval([54 87],x)),[54 87]))

a = 1 2 3 4 5 6 7 8 9 10 b = 141 195 249 303 357 411 465 519 573 627 [Warning: Polynomial is badly conditioned. Add points with distinct X values, reduce the degree of the polynomial, or try centering and scaling as described in HELP POLYFIT.] [> In polyfit at 76 In guess_the_coefficients at 4 In verifyCode>evaluateCode at 226 In verifyCode at 40 In fevalJSON at 14] c = 0 0 0 0 0 0 0 0 54 87 ans = 54 87

4

Pass

%% assert(isequal(guess_the_coefficients(@(x)polyval([49 40 68],x)),[49 40 68]))

a = 1 2 3 4 5 6 7 8 9 10 b = Columns 1 through 8 157 344 629 1012 1493 2072 2749 3524 Columns 9 through 10 4397 5368 [Warning: Polynomial is badly conditioned. Add points with distinct X values, reduce the degree of the polynomial, or try centering and scaling as described in HELP POLYFIT.] [> In polyfit at 76 In guess_the_coefficients at 4 In verifyCode>evaluateCode at 226 In verifyCode at 40 In fevalJSON at 14] c = 0 0 0 0 0 0 0 49 40 68 ans = 49 40 68

5

Pass

%% assert(isequal(guess_the_coefficients(@(x)polyval([75 53 35 15],x)),[75 53 35 15]))

a = 1 2 3 4 5 6 7 8 9 10 b = Columns 1 through 8 178 897 2622 5803 10890 18333 28582 42087 Columns 9 through 10 59298 80665 [Warning: Polynomial is badly conditioned. Add points with distinct X values, reduce the degree of the polynomial, or try centering and scaling as described in HELP POLYFIT.] [> In polyfit at 76 In guess_the_coefficients at 4 In verifyCode>evaluateCode at 226 In verifyCode at 40 In fevalJSON at 14] c = 0 0 0 0 0 0 75 53 35 15 ans = 75 53 35 15

6

Pass

%% assert(isequal(guess_the_coefficients(@(x)polyval([59 27 5 76 25],x)),[59 27 5 76 25]))

a = 1 2 3 4 5 6 7 8 9 10 b = Columns 1 through 8 192 1357 5806 17241 40780 82957 151722 256441 Columns 9 through 10 407896 618285 [Warning: Polynomial is badly conditioned. Add points with distinct X values, reduce the degree of the polynomial, or try centering and scaling as described in HELP POLYFIT.] [> In polyfit at 76 In guess_the_coefficients at 4 In verifyCode>evaluateCode at 226 In verifyCode at 40 In fevalJSON at 14] c = 0 0 0 0 0 59 27 5 76 25 ans = 59 27 5 76 25