We want to construct a piecewise cubic function that agrees with a function and its derivatives at the nodes.
This is the basis for Bezier curves.

For simplicity, assume we have y = f(x), and we want to make a plot y = f (x) for a < x < b.  We break up the interval [a, b] into n intervals of size h = (b-a)/n.  We make a list of the f(x) and f ‘(x) at each of the nodes.

(* This cell will plot a linear spline function for the function f *)
f[x_] := Exp[-x^2];
a = 0;
b = 3;
n = 2;
(* end of inputs to plot cell *)
h = (b-a)/n;
xList = Table[x, {x, a, b, h}];
yList = Table[f[x], {x, a, b, h}];
vList = Table[f'[x], {x,a, b, h}];
plots = {};
Do[
x0= xList[[i]];
y0 = yList[[i]];
v0 = vList[[i]];  (* The linear spline does not use the slopes v0 or v1 *)
x1  = xList[[i +1]];
y1 = yList[[i+1]];
v1 = vList[[i+1]];
newPlot = Plot[y0 + ((y1 - y0)/h)(x-x0), {x, x0, x1}];
AppendTo[plots, newPlot]
,{i, 1, n}];
plotf = Plot[f[x], {x, a, b}, PlotStyle -> {Red, Dashed}];
Show[plotf, plots, PlotRange -> All]

(* This cell will plot a Bezier curve for the function f *)
f[x_] := Exp[-x^2];
a = 0;
b = 3;
n = 2;
(* end of inputs to plot cell *)
h = (b-a)/n;
xList = Table[x, {x, a, b, h}];
yList = Table[f[x], {x, a, b, h}];
vList = Table[f'[x], {x,a, b, h}];
plots = {};
Do[
x0= xList[[i]];
y0 = yList[[i]];
v0 = vList[[i]];
x1  = xList[[i +1]];
y1 = yList[[i+1]];
v1 = vList[[i+1]];
(* change the coefficients c and d, to plot the n=1 clamped cubic spline for x between x0 and x1 *)
(* This spline has y(x0) = y0, y(x1) = y1, y'(x0) = v0, and y'(x1) = v1 *)
c = 0;
d = 0;
newPlot = Plot[y0 + v0 (x-x0)+ c(x-x0)^2 + d(x-x0)^3, {x, x0, x1}];
AppendTo[plots, newPlot]
,{i, 1, n}];
plotf = Plot[f[x], {x, a, b}, PlotStyle -> {Red, Dashed}];
Show[plotf, plots, PlotRange -> All]