Double integral by composite Simpson rule

2 Ansichten (letzte 30 Tage)
Neza Krzan
Neza Krzan am 19 Mai 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)));

Antworten (0)

Kategorien

Mehr zu Numerical Integration and Differential Equations finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by