I'm using MATLAB R2013a. I want to input an equation in Matlab, e.g., $f(x) = x^2 - 2 x + 3$. I want it to be inputted by the user. I use the
inline function for this:
func = input('Enter a function: ','s'); f = inline(func);
I have been able to do some work with this, but I want to differentiate the equation. I was trying to use the
diff function for this, but it doesn't work. Using
diff(f,x); results in an error. How can I solve my problem?