Hello, Mapleprimes' users.

I am using spline to fit a function to a given data (instead of polynomial). I created two examples with data of y=cos(x).

The first example has a domain X=0..10 and its result is satisfactory.

Ths second example has a larger domain, X=0..15, but I couldn't plot the spline function. The function fits well, but its line ends at X=~10.

Then I ckecked this spline assigning several values of X, and all the results are correct. The problem is on the plot step.

My mw file is:

> restart;

> with(plots);

> with(CurveFitting);

> plotsetup(default);

First Exemple Data (Y=cos(X)):

> X := [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10];

> Y := [1, .54, -.41, -.99, -.65, .28, .96, .75, -.14, -.91, -.83];

> Piece1 := spline(X, Y, x, 2);

> fig1 := plot(Piece1, view = [0 .. 15, -1 .. 1]);

> fig2 := pointplot(X, Y);

> display(fig1, fig2);

_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

Second Example Data (Y=cos(X))::

> X := [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15];

> Y := [1, .54, -.41, -.99, -.65, .28, .96, .75, -.14, -.91, -.83, 0., .84, .91, .13, -.76];

> Piece2 := spline(X, Y, x, 2);

> fig3 := plot(Piece2, view = [0 .. 15, -1 .. 1]);

> fig4 := pointplot(X, Y);

> display(fig3, fig4);

> test := unapply(Piece2, x);

> test(15);

test(15)=-0.76 #correct value!

My actual problem involves data from X=0 to X=300, and I have the same issue in this case.

Thanks.