You could connect the two endpoints with a cubic Bézier curve cubic Bézier curve, which achieves 1st- and 2nd-derivative continuity at the endpoints ($P_0$ and $P_3$ in the illustration below).
[![Bezier][1]][1]
(Image from [CartouCHe](http://www.e-cartouche.ch/content_reg/cartouche/graphics/en/html/Curves_learningObject2.htmlrl).)