How to evaluate a derivative of a function at a point?
Show older comments
I was wondering if anyone can help. I am taking the derivative of cos(x)-x, and then using subs to evaluate it at a point, but instead of getting an answer it returns me this:
syms x
func = @(x) cos(x) - x
newfunc = (subs(diff(func,x,1),x,1))
newfunc =
- sin(1) - 1
I found an answer online of putting vpa() before subs, which makes it work, but I was wondering why subs isn't able to evaluate it. Thanks!
Accepted Answer
More Answers (0)
Categories
Find more on Common Operations in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!