To approximate an experimental data function $f(t)$ with $t \in (t_{min},t_{max})$ I used a cubic spline $s(p)=(t(p),f(p))$ with the parameter $p \in (0,1)$ and $p = t/(t_{max}-t_{min})$ by using the command BSplineFunction. To take the time derivative I use the chain rule $s'=ds/dt = ds/dp \cdot dp/dt = s'(p)/(t_{max}-t_{min})$. When I try plotting the derivative $df/dt = s'[[2]]$ by
Show[ParametricPlot[{93*p, 1/93 s'[p][[2]]}, {p, 0, 1}], AspectRatio -> 1]
it shows me the error warning
Part::partw: Part 2 of BSplineFunction[{{0.,1.}},<>][t] does not exist. >>
but still shows the correct graph. What went wrong?
data = {{3.107, 0.997}, {6.851, 1.008}, {10.594, 1.011}, {14.338,
1.007}, {18.081, 0.977}, {21.825, 0.967}, {25.568, 0.917}, {29.311,
0.852}, {33.055, 0.736}, {36.798, 0.533}, {40.542, 0.336}, {44.285,
0.205}, {48.029, 0.111}, {51.772, 0.074}, {55.516, 0.044}, {59.259,
0.032}, {63.003, 0.034}, {66.746, 0.01}, {70.49, 0.026}, {74.233,
0.01}, {77.977, 0.016}, {81.72, 0.002}, {85.464, -0.002}, {89.207,
0.01}, {92.951, 0.01}}
s = BSplineFunction[data, SplineDegree -> 3];
There is a caveat to the method. When fitting a spline to data p is not necessarily proportional to the independent variable. In my case the relationship between $p$ and $t(p)$ deviates substantially from linearity outside the range $p \in (0.025, 0.975)$.
Is there a better way to get the derivative?