Find Derivative of Numeric Function
显示 更早的评论
Take for example
f = @(x) x^3;
Is there a builtin function to find the derivative?
回答(1 个)
David Hill
2021-2-11
I am not sure what the best way is, but I would use symbolic and then convert.
syms x;
f=x^3;
df=str2func(['@(x)',char(diff(f))]);
1 个评论
Lol. I'm not sure there is a best way. An alternative might be:
f = @(x) x^3;
syms x
fp = matlabFunction(diff(f(x)))
类别
在 帮助中心 和 File Exchange 中查找有关 MATLAB 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!