Double integral by composite Simpson rule

2 views (last 30 days)
Neza Krzan
Neza Krzan on 19 May 2021
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)));

Answers (0)

Categories

Find more on Numerical Integration and Differential Equations in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!