Question
Thanks in advance!
A 2D surface S(x,y), is given by S(x, y )=(x/3 + 2)2 (y+ 1) Compute the double integral analytically S (x, y)dxdy. Compute the same double integral of S(x,y) numerically, assuming a discrete set of data points located at the intersections of x andy vectors as shown in the figm·e below. Note that the limits of integration are still the same as for part (a). Write a MATLAB ftmction that will compute the volume under the surface S(x,y) using the trapezoidal method approximation with the discrete points given. You may use the trapz (x, y) ftmction to assist which can handle va1yrng h widths. What is the percent relative en·or on the total volume between parts (a) and (b)? Is the numerical method practical/accurate?
Explanation / Answer
S=@(x,y) ((x/3)+2)^2*(y+1);
X=[0 0.3 0.9 1.4 2 2.5];
Y=[0 0.8 2.1 3.2 4.1 5];
Z=(Y+1)'*((X./3)+2).^2;
Volume=trapz(X,trapz(Y,Z,2),1);
Answer= 266.1081;