通过双重求和在MATLAB中逼近双积分

时间:2014-10-30 00:18:35

标签: matlab integration

我试图通过使用双和的概念使用MATLAB以数字方式逼近双积分。假设我试图整合的功能是x和y,我可以执行以下操作,

result=0;
for i=1:0.1:x
for j=1:0.1:y
fun(i,j)= x(i).*y(j)*0.1^2; %the function I want to integrate times the increment
result = result + fun(i,j);
end
end

也有人知道最佳近似积分的最佳增量是多少? 我很感激任何建议!

1 个答案:

答案 0 :(得分:0)

数值整合是一个相当复杂的主题。可能最好的标准选择是使用(http://www.mathworks.nl/help/matlab/ref/integral2.html#btdgcqq

result = integral2(fun,xmin,xmax,ymin,ymax)

如果您对数字集成感兴趣,请查看Wiki(http://en.wikipedia.org/wiki/Numerical_integration)。对于特定的实现,Numerical Recipes是一个很好的参考点(http://www.it.uom.gr/teaching/linearalgebra/NumericalRecipiesInC/,抱歉,没有Matlab版本)