Double integral by composite Simpson rule

Helo :)
I need to write Composite Simpson rule for double integration od values x and y. I have a function , where lower limit for x is and upper is and lower limit for y is and upper limit for y is , and and . So far I have this code, but it is for one value and i dont know how to fix it. I wanna first write a code for this rule and than make calculation for my function. Can please someone hlep mi fix this code:
function vr = simpson2d(f,a,b,c,d,n,m)
x = a:n:b;
y = c:m:d;
h=(b-a)/n;
vr= h/3*(f(xi(1))+2*sum(f(xi(3:2:end-2)))+4*sum(f(xi(2:2:end)))+f(xi(end)));

Réponses (0)

Catégories

En savoir plus sur Numerical Integration and Differential Equations dans Centre d'aide et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by