Cody

Solution 553523

Submitted on 7 Jan 2015 by Alfonso Nieto-Castanon
  • Size: 21
  • This is the leading solution.
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   Pass
%% n = 1:10; a = sin(2*pi*(50/500)*n); b = [0.5878 0.9458 0.9511 0.7323 0.2484 -0.3112 -0.7803 -0.9511 -0.9276 -0.5413]; assert(sqrt(sum((b - stc(a,.9)).^2))<.1)

[Warning: INTERP1(...,'CUBIC') will change in a future release. Use INTERP1(...,'PCHIP') instead.] [> In interp1>sanitycheckmethod at 291 In interp1>parseinputs at 438 In interp1 at 82 In stc at 2 In verifyCode>evaluateCode at 238 In verifyCode at 43 In fevalJSON at 14]

2   Pass
%% a = [1 2 1 3 1 4 5]; b = [1.0000 1.9900 1.1040 2.5680 1.7040 2.3125 4.5680]; assert(sqrt(sum((b - stc(a,.9)).^2))<.1);

[Warning: INTERP1(...,'CUBIC') will change in a future release. Use INTERP1(...,'PCHIP') instead.] [> In interp1>sanitycheckmethod at 291 In interp1>parseinputs at 438 In interp1 at 82 In stc at 2 In verifyCode>evaluateCode at 238 In verifyCode at 43 In fevalJSON at 14]

3   Pass
%% n = 1:10000; a = sin(2*pi*(50/500)*n); b = a; assert(sqrt(sum((b - stc(a,1)).^2))<.1);

[Warning: INTERP1(...,'CUBIC') will change in a future release. Use INTERP1(...,'PCHIP') instead.] [> In interp1>sanitycheckmethod at 291 In interp1>parseinputs at 438 In interp1 at 82 In stc at 2 In verifyCode>evaluateCode at 238 In verifyCode at 43 In fevalJSON at 14]