![]() |
VOOZH | about |
Pre-requisites: Definite Integration
MATLAB is a high-performance language that is used for matrix manipulation, performing technical computations, graph plottings, etc. It stands for Matrix Laboratory. With the help of this function, we can compute definite integration. We use quad function which takes the function and its limits as its arguments.
Syntax:
ans = quad('f(x)' , a, b);
where ans is the variable in which we are storing the integral's value;
f(x) is the function which is to be integrated;
a and b are the lower and upper limits of the integral.
Suppose that, f(x) = ∫x^2 dx with lower limit = 2 and upper limit = 3. then solution is:
We know that, ∫x^n dx = (x^(n+1))/(n+1) So ∫x^2 dx = (x^3)/3 f(x) = (x^3)/3 with lower limit = 2 and upper limit = 3. = (3^3)/3 - (2^3)/3 = 19/3 = 6.3333
Example 1:
Output:
Explanation:
Now take another example, f(x) = ∫sin(x)dx with lower limit = 0 and upper limit = 3.14
Solution:
We know that, ∫sin(x)dx = -cos(x) f(x) = -cos(x) with lower limit = 0 and upper limit = 3.14 = -cos(3.14) - (-cos(0)) = 1 + 1 = 2
Example 2:
Output: