MATLAB: Can someone help me with derivatives

derivatives

well im trying to work on matlab which is quite easy but ive been struggling with derivatives lately
f(x)=x^2+4*x+5 f'(0)=4
i dont know how to solve this can someone help me
i did
syms x
f=x^2+4*x+5
diff(f)
but ii have to give x=0

Best Answer

You will need to create ‘f’ as a symbolic function (possible in R2012a and later versions).
Either of these will work:
syms f(x) x
f = x^2+4*x+5
df = diff(f)
or:
syms x
f(x) = x^2+4*x+5
df = diff(f)
Then, evaluating it when ‘x’ is 0 should be straightforward.