Josemi Asked: 2020-06-04 01:05:57 +0800 CST 2020-06-04 01:05:57 +0800 CST 2020-06-04 01:05:57 +0800 CST Derivatives in matlab 772 To make an integral in matlab we can execute the following: syms variable int(funcion,variable,a,b) Can a derivative be done in the same way symbolically? matlab 1 Answers Voted Best Answer Jacobo Córdova 2020-06-04T06:19:45+08:002020-06-04T06:19:45+08:00 Yes. with diff() The diff() function has the following syntax diff(F) diff(F,var) diff(F,n) diff(F,var,n) diff(F,var1,...,varN) To achieve what you propose: Derivative of a function of one variable: syms x f(x) = sin(x^2); df = diff(f,x) df(x) = 2*x*cos(x^2) Differentiate functions of several variables find the first derivative of the expression syms x t diff(sin(x*t^2)) ans = t^2*cos(t^2*x) Since the variable to derive from was not specified, diff uses the default variable defined by symvar for that expression, the variable is x: symvar(sin(x*t^2),1) ans = x Now to find the derivative of the expression with respect to the variable t: diff(sin(x*t^2),t) ans = 2*t*x*cos(t^2*x) With translated information from diff() in MathWorks
Yes. with diff()
The diff() function has the following syntax
To achieve what you propose:
Derivative of a function of one variable:
Differentiate functions of several variables
find the first derivative of the expression
Since the variable to derive from was not specified, diff uses the default variable defined by symvar for that expression, the variable is x:
Now to find the derivative of the expression with respect to the variable t:
With translated information from diff() in MathWorks