Application of Differential Function in MATLAB
Introduction: Differentiation is a process, where we find the instantaneous rate of change in
function based on one of its variables. There are many complex functions whose derivatives are
very difficult, but with the help of MATLAB we can solve it very easily.
Methodology: In this report, 2 commands and some functions will be used to make
derivatives with the help of MATLAB. The commands are ‘syms and diff’. Some functions and
derivatives are shown below :
1. syms x
Y=sin(x);
F=diff(Y)
2. syms x y
Z=3*sin(x)-12*cos(y);
F1=diff(Z,x)
F2=diff(Z,y)
3. syms x y z
A=sin(x)+cos(y)+exp(z);
F3=diff(A)
4. syms x
B=(sec(x)*exp(-1.5*x))/(tan(x)*exp(x)-x^3);
F4=diff(B)
5. syms x
x=1:15;
C= (cos(x).*exp(-1.5*x) + log(x)./(3*x.^2.*cos(x) - sin(x).*exp(x)*0));
plot(x,C)
Result:
Discussion: For differentiation, we can differentiation an array of data using
gradient, which uses a finite difference formula to calculate derivatives of
functional expressions, we must use MATLAB.
Conclusion: In MATLAB, this calculation can easily be achieved using the
differentiation function. Typing and run the first example from the documentation
into MATLAB.