Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Write a mat lab function whose name is yourlastname.client2.m to compute the dou

ID: 3578326 • Letter: W

Question


Write a mat lab function whose name is yourlastname.client2.m to compute the double integral of a function f(x, y) defined using a function handle in matlab over a parallelogram defined by the sectors, t and that is translated from the origin by a vector r. The first line of your code should be function vol = Yourlastname.dint2 (f, s, t, r) Make sun to test your code with a function like f(x, y) = x over the region whose vertices ire given by (1, 2), (3, 2), (2, 3) and (4, 3), so that s = (2, 0), t = (1, 1), and r = (1, 2). Use other functions and parallelograms if necessary.

Explanation / Answer

function vol = dint2(f,s,t,r)

% calculating xmin and xmax
xmin = s(1);
xmax = s(1);

if xmin > t(1)
xmin = t(1);
end

if xmax < t(1)
xmax = t(1);
end

if xmin > r(1)
xmin = r(1);
end

if xmax < r(1)
xmax = r(1);
end

% calculating ymin and ymax
ymin = s(2);
ymax = s(2);

if ymin > t(2)
ymin = t(2);
end

if ymax < t(2)
ymax = t(2);
end

if ymin > r(2)
ymin = r(2);
end

if ymax < r(2)
ymax = r(2);
end

vol = integral2(f,xmin,xmax,ymin,ymax);

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote