%linear and cubic splines:
noNodes=6;
x_nodes=linspace(0,12,noNodes);
y_values=sin(x_nodes);
t=linspace(0,12,100);
exact=sin(t);
Linear=interp1(x_nodes,y_values,t);
Cubic=spline(x_nodes,y_values,t);
figure(1)
plot(x_nodes,y_values,'o',t,exact,'-g',t,Linear,':.r',t,Cubic,'.-.b')
legend('Nodes','exact','linear spline','cubic spline')