Respuestas (1)

David Hill
David Hill el 11 de Feb. de 2021
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 comentario

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)))
fp = function_handle with value:
@(x)x.^2.*3.0

Iniciar sesión para comentar.

Categorías

Más información sobre MATLAB en Centro de ayuda y File Exchange.

Etiquetas

Preguntada:

el 11 de Feb. de 2021

Comentada:

el 11 de Feb. de 2021

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by