How do I get Derivative of an inserted function ?
Show older comments
I want user insert the function and the program get Derivative of it by using the given code but it wouldn't work
and show me this message :
Undefined function 'diff' for input arguments of type 'inline'.
Error in Untitled (line 8)
m=diff(f)
.........................
my code :
clc
clear
str = input('Give an equation in x: ','s') ;
x = input('Type in a value of x: ') ;
f = inline(str,'x') ;
y = feval(f,x) ;
m=diff(f)
disp(['"' str '", for x = ' num2str(x) ', equals ' num2str(y)]) ;
1 Comment
amir
on 12 Nov 2020
Accepted Answer
More Answers (0)
Categories
Find more on Search Path 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!