clear
n=45; // widht
m=23; // length
// total 990 blocks m*n
a=-2; b=1; // x-limits
c=2; d=4; // y-limits
f=@(x,y) 4.0*x.^3.*y+0.7.*x.^2.*y+2.5.*x+0.2.*y; //function
x=linspace(a,b,n);
y=linspace(c,d,m);
h1=(b-a)/n
h2=(d-c)/m
dA=h1*h2
[X,Y]=meshgrid(x,y); //did a meshgrid cause q wouldnt accept different index bounds without meshgriding.
q=sum((sum(dA*f(X,Y))))
Ive been using a formula for double riemanns at this link. https://activecalculus.org/multi/S-11-1-Double-Integrals-Rectangles.html
these are the answers
1.I=81.3000.
2.I-left=-87.4287 //-84.5523 my result
3.I-Right=-75.1072
I can't see what im doing wrong. I need input from somebody.