Simpson for odd number of subintervals

7 views (last 30 days)
Djamel HAMMOUDI
Djamel HAMMOUDI on 28 Dec 2017
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)

David Goodmanson
David Goodmanson on 30 Dec 2017
Edited: David Goodmanson on 30 Dec 2017
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
Djamel HAMMOUDI
Djamel HAMMOUDI on 31 Dec 2017
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

Community Treasure Hunt

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

Start Hunting!