I have MATLAB2016b and am using the Symbolic Math Toolbox.
For something like
syms y f = y^2 + y
I get the following output:
f