MATLAB: Differentiate an inline function

diff()inline function

Hi!
I have an assignment in Matlab and I need to find a function's 8th and 9th derivate. This function is an inline function, as it is an input from the user.
I have been trying to use the function diff, but it tells me: «Function 'diff' is not supported for class 'inline'.»
Any ideas?

Best Answer

f = inline('x^8'); % Our inline function.
D8 = diff(sym(f),8) % Find the 8th derivative
D8 == prod(1:8) % Check. ans = 1 as expected.
Related Question