You basically have it. The plot function format is "plot(x,y)" though, meaning x coordinates and y coordinates, so your version is probably the mirrored image of what you want. You can just append the rest.
plot(x,f(x),x,df(x),x,df2(x))
xlim(x([ 1 end ]))
grid on
xlabel('x')
ylabel('y')
legend('f(x)','df(x)','ddf(x)')