MATLAB: How to obtain anonymous function after derivative

anonymous functionderivativefunctionfunction handleMATLABSymbolic Math Toolbox

Hi,
can we have an anonymous function after we differntiate an anonymous function? for example see blow
f = @(x) x^4+3*x^2;
now I want to have another anonymous function which is derivative of f(x) .

Best Answer

syms x
df = matlabFunction(diff(f(x), x), 'vars', {x})
Related Question