‘What am I missing here?’
Most likely, using the Symbolic Math Toolbox.
Try this:
syms E I L w_0 x
func(x) = (((w_0*L)/(3*(pi^4)*E*I))*48*(L^3)*cos((pi*x)/(2*L))-48*(L^3)+(3*(pi^3)*L*(x^2))-((pi^3)*(x^3)));
dfunc = matlabFunction(simplify(diff(func,x), 500));
Note that ‘dfunc’ is now an anonymous function that can be used in numeric calculations outside of the Symbolic Math Toolbox.