MATLAB – Differentiation
In general, differentiation is nothing but the rate of change in a function based on one of its variables. MATLAB is very useful in solving these derivatives, integrals etc. There are certain rules to be followed while solving derivatives, which will be discussed in the later part. Let’s see some examples to understand things better.
- f: Function
- n: Order of derivative
ans = 6*t - 4/t^3
Elementary Rules of Differentiation
Let’s quickly recall the rules to be followed while solving and manipulating the functions. Let us consider the same traditional notation for representing the order of derivative function (i.e f'(x) for first-order derivative and f”(x) for second-order derivative). Following are some important rules of differentiation:
For any functions, f and g, b, any real numbers a and b are the constants of the functions.
h(x) = af(x) + bg(x), with respect to x is h'(x) = af'(x) + bg'(x)
The sum and subtraction rules of derivatives are as follows:
(f(x) + g(x))' = f'(x) + g'(x) (f(x) - g(x))' = f'(x) - g'(x)
If h(x) is product of two functions f(x) and g(x), then h'(x) will be:
(f(x) * g(x))' = (f'(x) * g(x)) + (f(x) * g'(x))
The quotient rule states that (Low * derivative of High) – (High * derivative of Low), divided by (square of the Low). Let’s understand it better by taking function f(x) and g(x).
( f/g )' = (g*f' - fg') / g2
The reciprocal rule is defined as, if f(x) is a function, then the derivative of its reciprocal (i.e 1/f) will be as follows.
(1/f(x))' = -f / f2
The power rule is described as if f(x) = yn is a function, then it’s derivative is.
y(n)' = n * yn-1
Now let’s see some examples to understand the above rules better.
sumDer = 2 subDer = 3*x^2 prodDer = 15*x^2 quoDer = (4*x)/(x^2 + 2) - (4*x^3)/(x^2 + 2)^2 powDer = 34*x*(x^2 + 1)^16