Cody

Problem 43637. For given vectors x,y find coresponding spline coefficients.

Solution 2584819

Submitted on 19 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
x =[ -3 -2 0 2 3] y =[ 0 0 1 0 0] y_correct=[-3 -2 0 2 3]; assert(isequal(SplCoef(x,y),y_correct))

x = -3 -2 0 2 3 y = 0 0 1 0 0 y = struct with fields: form: 'pp' breaks: [-3 -2 0 2 3] coefs: [4×4 double] pieces: 4 order: 4 dim: 1

Assertion failed.

2   Fail
x = 1:0.5:5 y =sin(x) y_correct=[ 1.0000 1.5000 2.0000 2.5000 3.0000 3.5000 4.0000 4.5000 5.0000]; assert(isequal(SplCoef(x,y),y_correct))

x = 1.0000 1.5000 2.0000 2.5000 3.0000 3.5000 4.0000 4.5000 5.0000 y = 0.8415 0.9975 0.9093 0.5985 0.1411 -0.3508 -0.7568 -0.9775 -0.9589 y = struct with fields: form: 'pp' breaks: [1 1.5000 2 2.5000 3 3.5000 4 4.5000 5] coefs: [8×4 double] pieces: 8 order: 4 dim: 1

Assertion failed.