MATLAB: Differentiation of the equation

differentiationMATLAB

here is an equation how to differentiate 'y' from that in live script
i tried diff() but it is not working.
y=@(x) (-0.6*x^2+2.4*x+5.5)

Best Answer

Analytical expression for derivative of 'y' is only possible through the Symbolic toolbox
syms x
y = -0.6*x^2+2.4*x+5.5;
dy = diff(y)
Result
>> dy
dy =
12/5 - (6*x)/5