📄 5_4.asv
字号:
%%%%%%%% Double Integration by the Simpson's Rule %%%%%%%%
nx=input('Number of intervals in x_direction:');
ny=input('Number of intervals in y_direction:');
a=input('Lower limit of x,a?');
b=input('Lower limit of x,b?');
hx=(b-a)/nx;
x=[a:hx:b];
cy=c(x);
dy=d(x);
hy=(d(x)-c(x))/ny;
Result=0;
temp=0;
for i=1:nx
for j=1:ny
y=[c(j):hy:d(j)]
y=f(x(i),y)
temp=hy(j)/2*(2*sum(y)-f(x(i),c(j))-f(x(i),d(j)));
end
if i~=1&i~=nx temp=temp*2;end
Result=Result+temp;
end
Result=hx/2*Result
h=(b-a)/n;
x=[a:h:b];
y=f(x);
Result=h/2*
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -