Numerical Integration using Simpson's 3/8 Rule

バージョン 1.0.0 (1.69 KB) 作成者: JPS
This file contains the simpson38 function that calculates the integral of a mathematical function f(x) using composite Simpson's 3/8 Rule.
ダウンロード: 365
更新 2020/11/26

ライセンスの表示

Simpson's 3/8 rule is a popular method to numerically evaluate the definite integral of a mathematical function f(x). It is a special case of the Newton-Cotes curve fitting formula where any given function is broken down into pieces of equal finite width(let's call this width 'n'). The function is broken in such a way that the number of pieces is a multiple of 3. In other words, n is a multiple of 3. So, if we take the simplest case where n = 3, there will be 4 points where the function's value is known. A cubic polynomial is to be fitted between those 4 points. The area under this curve is an approximation to the area under the curve f(x) in that piece. As the value of n increases, the approximation gets better and better and eventually, it will tend to the actual value of the integral.

The function simpson38 takes up 3 input arguments(a function handle, lower limit, and upper limit) and the 4th one(number of pieces) is optional. By default, it will take n as 60 pieces.

It returns the value of the definite integral as the output.

Example:

Inputs:
>>f = @(x) 1 / (1 + x);
>>I = simpson38(f , 0 , 1 , 18)

Output:

>>I = 0.6931

引用

JPS (2025). Numerical Integration using Simpson's 3/8 Rule (https://jp.mathworks.com/matlabcentral/fileexchange/83468-numerical-integration-using-simpson-s-3-8-rule), MATLAB Central File Exchange. に取得済み.

MATLAB リリースの互換性
作成: R2020b
すべてのリリースと互換性あり
プラットフォームの互換性
Windows macOS Linux
タグ タグを追加

Community Treasure Hunt

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

Start Hunting!
バージョン 公開済み リリース ノート
1.0.0