is there a method in simpson 1/3 rule for double integration that first i give only y limit after getting this integration i give x limit and function has both x and y variable in multiplication so i cant use simpson 1/3 rule for single integration i am using a simpson 1/3 rule for double integration the code but in this code i have to give x and y limit both at a same time the code is
syms x y;f = inline(f(x,y));c = inline('1');d = inline('2');a =0; b = x;m = 4;n = 4;hx = (b-a)/n;An = 0;Ae = 0;Ao = 0;for i = 0:nx = a + i*hx;ya = c(x);yb = d(x);hy = (d(x) - c(x))/m;Bn = f(x,ya) + f(x,yb);Be = 0;Bo = 0;for j = 1:m-1y = ya + j*hy;z = f(x,y);if rem(j,2)==0Be = Be + z;elseBo = Bo + z;endendA1 = (Bn + 4*Bo + 2*Be)*hy/3;if i == 0 | i == nAn = An + A1;elseif rem(i,2)==0Ae = Ae + A1;elseAo = Ao + A1;endendendDint = (An + 4*Ao + 2*Ae)*hx/3;end
Best Answer