Simpson for odd number of subintervals
7 次查看(过去 30 天)
显示 更早的评论
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 !
0 个评论
回答(1 个)
David Goodmanson
2017-12-30
编辑:David Goodmanson
2017-12-30
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 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Numerical Integration and Differential Equations 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!