MATLAB: Equation how to evaluate and obtain a value

equationSymbolic Math Toolboxsyms

Hi
I have create an equation
syms x
f(x) = exp(5*x);
df(x) = diff(f,x);
and then I want to evaluate f and df when x = 2
f(2)
Df(2)
But the result is not a value. I obtain f(2) = exp(10) df(2) = 5 exp (10)
How can I calculate to obtain a value : f(2) = 2.2026e+04 df(2)= 1.1013e+05

Best Answer

Please try use function vpa:
syms x
f(x) = exp(5*x);
df(x) = diff(f,x);
vpa(f(2))
vpa(df(2))
Related Question