MATLAB: Creating a symbolic variable, then using it as a real variable

diff()syms

I need my program to calculate the derivative of a function, and as far as I understand that means I need to make a symbolic variable. How then can I continue to use that variable as a real vector?
This is what I have tried:
syms x
y = input('Please enter a valid function of x')
deriv = diff(y)
syms clear
x = 0:pi/30:pi;
plot(x,y)

Best Answer

syms x
y = input('Please enter a valid function of x: ')
deriv = diff(y) % This will be symbolic
x = 0:pi/30:pi; % Now x is a double.
y = matlabFunction(y) % y is a function handle.
plot(x,y(x))