# B-Spline Derivatives

I'm attempting to understand how B-Spline derivatives work.

To do this, i've generated some data in MATLAB to plot sin(x) over 0 - 2*pi. I then use the splinetool to fit an order 2 spline to the data which it fits perfectly. However, when I look at the 1st derivative of this sine wave data it's max is 0.017 and it's min is -0.017.

I don't understand why the derivative of this data doesn't give exactly cos(x) with a max and min of 1, -1. Any insights please?

-
Unless you specified that the derivatives of your B-spline take specific values and derivatives at specific points, in general you cannot expect your B-spline to take the exact same values as the function you're approximating at points other than the points you derived your B-spline from. – J. M. Nov 29 '10 at 0:23
The data points should be disclosed. Suppose a spline interpolates at the three points x = 0, pi, 2pi? – hardmath Nov 29 '10 at 0:41

If the slopes of such a function vary between +0.017 and -0.017 on the interval $[0,2\pi]$, then by the Mean Value Theorem there cannot be more than $0.034\pi$ or about 0.1 between the minimum and maximum function values.
So either there are no data points near the minimum and maximum of $sin(x)$ on this interval or else some error has been made in computation (perhaps a mistake in scaling the x-axis that stretches everything out).