**Info**

This question is closed. Reopen it to edit or answer.

# Perform the Trapezoidal Method to compute the definite intergral of a function

1 view (last 30 days)

Show older comments

This program will perform the Trapezoidal Method to compute the definite integral of a given function f(x) over the given interval of a to b. This technique is explained in the course textbook in section 13.5 (Numerical Integration). T0 = (1/2)(f(a)+f(b))(b-a) Tk = (1/2)(Tk-1)+delta xk summation from i=1 to n-1 of f(a+i*delta xk): for all odd numbers from 1 to n-1.

where: delta xk = (b-a)/2^k n= 2^k f(x)= 1/(x^2) is the function to be evaluated

This Program should perform at least the following functions: 1. The program should display a title banner which has the title of Trapezoidal Method of Integration and some brief text that explains the functionality of the program. 2. The program should accept the number of iterations (k) to be ran. For this problem one test case is sufficient if it is greater than 6. 3. Write a function that computes the value of f(x) for any given x. Look at Chapter 6 of the course textbook for examples. 4. Use the Trapezoidal Method to compute the integral over the range 1 to 2 (a=1, b=2). 5. Output to the screen the formatted result of the integration Method for each step k in Equation 4. Remembering that there will be at least 6 iterations based on other program requirements given.

##### 1 Comment

John D'Errico
on 21 Apr 2015

### Answers (0)

### See Also

### Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!