To do an integral in matlab we can execute the following:
syms variable
int(funcion,variable,a,b)
can a derivative be made in the same way in a symbolic way?
To do an integral in matlab we can execute the following:
syms variable
int(funcion,variable,a,b)
can a derivative be made in the same way in a symbolic way?
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:
syms x f(x) = sin(x^2); df = diff(f,x)
df(x) =
2*x*cos(x^2)
finds 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 diff is not specified, it 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 information translated from diff () in MathWorks