Create an anonymous function after Symbolic differentiation
显示 更早的评论
I want to differentiate a function f and the calculate the derivative of f at value of x. How can I do that? for example:
syms x
f=@(x) x^3+3*x+1;
g=diff(f(x))
Preferably I would like to create a function handle of the derivative and then calculate the derivative at x.
采纳的回答
更多回答(1 个)
Iman Ansari
2013-5-13
Hi.
syms x
f=@(x) x^3+3*x+1;
g=diff(f(x))
h=@(y) subs(g,y)
类别
在 帮助中心 和 File Exchange 中查找有关 Function Creation 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!