Products & Services Solutions Academia Support User Community Company

Learn more about Symbolic Math Toolbox   

diff - Differentiate symbolic expression

Syntax

diff(expr)
diff(expr, v)
diff(expr, sym('v'))
diff(expr, n)
diff(expr, v, n)
diff(expr, n, v)

Description

diff(expr) differentiates a symbolic expression expr with respect to its free variable as determined by symvar.

diff(expr, v) and diff(expr, sym('v')) differentiate expr with respect to v.

diff(expr, n) differentiates expr n times. n is a positive integer.

diff(expr, v, n) and diff(expr, n, v) differentiate expr with respect to v n times.

Examples

Differentiate the following single-variable expression one time:

syms x;
diff(sin(x^2))

The result is

ans =
2*x*cos(x^2)
 

Differentiate the following single-variable expression six times:

syms t;
diff(t^6,6)

The result is

ans =
720
 

Differentiate the following expression with respect to t:

syms x t;
diff(sin(x*t^2), t)

The result is

ans =
2*t*x*cos(t^2*x)

See Also

int | jacobian | symvar

  


Free Symbolic Math Interactive Kit

See how symbolic computations can help you find analytical solutions to math and engineering problems.

Get free kit

Trials Available

Try the latest version of symbolic math products.

Get trial software
 © 1984-2010- The MathWorks, Inc.    -   Site Help   -   Patents   -   Trademarks   -   Privacy Policy   -   Preventing Piracy   -   RSS