Simpson for odd number of subintervals

Hello I want to know whether it is possible to use simpson rule for the case of odd number of subintervals, if yes, How ?! Thank you all !

Answers (1)

Hi Djamel.
One approach is to use the usual Simpson's rule for all but three (consecutive) intervals and use Simpson's 3/8 rule for what is left over. Assume n points 1:n with n even, so there are an odd number of intervals. You can use the usual Simpson's rule on points 1 to n-3 (even number of intervals) and the 3/8 rule at the end. For equally spaced intervals of width h,
Integral = (3*h/8)*(f(n-3) + 3*f(n-2) + 3*f(n-1) + f(n))
Or you could put the 3/8 rule section at the beginning, or somewhere in the middle.

4 Comments

Thank you David, if we assume: n: points (even), (n-1) intervals which is odd, so: I have Used 1/3 simpson's rule for the (n-2) intervals which even. after that I have added the last interval using trapezoidal rule. What do you think?
Hi Djamel,
I don't think it's as good as using the 3/8 rule on the last three intervals. The error will quite likely be larger using trap, although it may still be acceptable.
Thank you David, I had a look to 3/8 simpson rule. it looks better. i ll use it. Thank you so much.

Sign in to comment.

Categories

Find more on Numerical Integration and Differential Equations in Help Center and File Exchange

Asked:

on 28 Dec 2017

Community Treasure Hunt

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

Start Hunting!