Cubic Spline Interpolation (Quadratic)
Cubic spline interpolation with quadratic boundary condition.
LaTeX source
\documentclass[11pt]{article} % graphics \usepackage{tikz} \usepackage{pgfplots} \pgfplotsset{compat=1.12} \usepgfplotslibrary{fillbetween} \begin{document} \begin{tikzpicture} \pgfplotsset{ scale only axis, } \begin{axis}[ xlabel=$x$, ylabel=$y$, samples=100, ]\addplot [only marks] table { -1.5 -1.2 -0.2 0 1 0.5 5 1 10 1.2 15 2 20 1 }; \addplot[color=red][domain=-1.5:-0.2]{+-9.963137852246763e-63*x^3+-0.23105483625285606*x^2+0.5302837014470678*x^1+0.11529893373952779*x^0}; \addplot[][domain=-0.2:1]{+0.04946307932075259*x^3+-0.20137698866040452*x^2+0.5362192709655581*x^1+0.11569463837409381*x^0}; \addplot[][domain=1:5]{+0.003443529449098756*x^3+-0.06331833904544301*x^2+0.3981606213505966*x^1+0.16171418824574765*x^0}; \addplot[][domain=5:10]{+0.0030034018786494034*x^3+-0.05671642548870272*x^2+0.36515105356689515*x^1+0.21673013455191673*x^0}; \addplot[][domain=10:15]{+-0.005550850469662351*x^3+0.1999111449606499*x^2+-2.2011246509266313*x^1+8.77098248286367*x^0}; \addplot[color=red][domain=15:20]{+0*x^3+-0.04987712617415588*x^2+1.5456994160954558*x^1+-9.963137852246764*x^0}; \end{axis} \end{tikzpicture} \end{document}