# B-spline curve fitting with conditions on derivatives

I have 5 data points. I'm trying to make a b-spline that passes through these points. At each data point I also have a derivative. The b-spline must meet this condition. Anyone that has an idea of how to approach this?

-

I'm assuming your "points" are in 2D or 3D. So, you have 5 points and 5 derivative vectors. You can insert a cubic segment between each pair of points. This will give you a cubic b-spline that is $C_1$-continuous.
Specifically, suppose your 5 points are $P_1, P_2, P_3, P_4, P_5$ and your 5 derivative vectors are $V_1, V_2, V_3, V_4, V_5$. Assign parameter values $t_1, t_2, t_3, t_4, t_5$ to the 5 points. You can use $t_1=0$, and $t_5=1$, and $t_2, t_3, t_4$ should be spaced according to the spacing of the points. Let $h_i = (t_{i+1}-t_i)/3$ for $i=1,2,3,4$.
Your b-spline should have knot sequence $$(0,0,0,0, t_2, t_2, t_3, t_3, t_4, t_4, 1,1,1,1)$$ and its control points should be $$P_1, \quad P_1 + h_1V_1,$$ $$P_2 - h_1V_2, \quad P_2 + h_2V_2,$$ $$P_3 - h_2V_3, \quad P_3 + h_3V_3,$$ $$P_4 - h_3V_4, \quad P_4 + h_4V_4,$$ $$P_5 - h_4V_5, \quad P_5$$