set terminal png
set output "plot.png"
set xrange [-6:5]
set yrange [-8:8]
set grid
set sample 1001

f(x) = sin(x) + (2*x)**(1/3)

spline(x) = x >= -5 && x < -3 ? +0.000000 - 0.000000*(x + 3) - 0.381365*(x + 3)**2 - 1.195510*(x + 3)**3 \
          : x >= -3 && x < -1 ? -0.027759 - 0.000000*(x + 1) + 0.039460*(x + 1)**2 - 1.958241*(x + 1)**3 \
          : x >= -1 && x < 1 ? +0.216242 - 0.166554*(x - 1) + 1.569531*(x - 1)**2 - 2.101392*(x - 1)**3 \
          : x >= 1 && x < 3 ? -0.371414 + 1.130898*(x - 3) - 0.847715*(x - 3)**2 + 2.101392*(x - 3)**3 \
          : 0

plot f(x), spline(x)

Add a code snippet to your website: www.paste.org