MATLAB Integration

After reading the MATLAB Integration topic, you will able to solve problems based on integration in MATLAB, and you will also understand how to use built-in function quad to calculate the integration.

Integration is very common mathematical operation. MATLAB has a built-in function quad to calculate the integration.

quad

The quad function uses the adaptive Simpson method of integration The general form of quad function is:

General Form:

q=quad(‘function_name’,a,b)

where,

  • q is the result of integration.
  • function_name is the function to be integrated.
  • a,b are the integration limits.

Example

Aim (1): To integrate f(x) given below using function quad, in MATLAB.

$f(x) = \int\limits_0^1 {\cos (x)dx} $

Program (1):

q=quad('cos',0,1)

Output (1):

q = 0.8415

Leave a Comment

error: Content is protected !!