Evaluate the following triple integral using single applications of Simpson’s 1/3 rule.

6 ビュー (過去 30 日間)
Moon Shadow
Moon Shadow 2016 年 11 月 29 日
コメント済み: Moon Shadow 2016 年 11 月 29 日
Evaluate the following triple integral using single applications of Simpson’s 1/3 rule. I have all the code for this question but I am getting error: Undefined function or variable 'simpson'. How to fix this error or add the 'simpson' function.
x1 = [-3:0.01:1];
fx1 = (x1).^2;
a= simpson(x1,fx1 , [],'1/3');
y1 = [0:0.01:2];
fy1 = ones(length(y1),1);
b= simpson(y1,fy1 , [],'1/3');
z1 = [-2:0.01:2];
fz1 = ones(length(z1),1);
c= simpson(z1,fz1 , [],'1/3');
I1 =a*b*c;
x2 = [-3:0.01:1];
fx2 = ones(length(x2),1);
aa= simpson(x2,fx2 , [],'1/3');
y2= [0:0.01:2];
fy2 = y2;
bb= simpson(y2,fy2 , [],'1/3');
z2 = [-2:0.01:2];
fz2 = z2;
cc= simpson(z2,fz2 , [],'1/3');
I2=aa*bb*cc;

回答 (2 件)

KSSV
KSSV 2016 年 11 月 29 日
There is no inbuilt function named simpson in matlab. You may check quad inbuilt function or download the file from the exchange.
  2 件のコメント
Moon Shadow
Moon Shadow 2016 年 11 月 29 日
What about simps function? I also get: Undefined function or variable 'simps'.
Moon Shadow
Moon Shadow 2016 年 11 月 29 日
Here Simpson function https://www.mathworks.com/matlabcentral/fileexchange/28726-simpson-s-rule-integration/content/simpsons.m

サインインしてコメントする。


Moon Shadow
Moon Shadow 2016 年 11 月 29 日
How to use file from the exchange in the matlab? I want to use simps function.
  1 件のコメント
KSSV
KSSV 2016 年 11 月 29 日
Download the file, copy in a folder, read the documentation part of the file, see how to input and then use. Mostly they give an example on how to run. First run the code for example case.

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeNumerical Integration and Differential Equations についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by