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

Write a matlab function whose name is your last name dint2.m to compute the doub

ID: 3581310 • Letter: W

Question


Write a matlab function whose name is your last name dint2.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 vector s, t, and that is translated from the origin by a vector r. The first line of your code should be function vole = your last name. dint2(f, s, t, r) Male sure to leis your code with a function like f(x, y) = x over the region whose vertices are 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

# We get 3 inputs s, t and r. Each will be of (x,y) type.

# To pass the input to integral2 function we have to find

# xmin, xmax and ymin, ymax.

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

# Intialize xmin and xmax arbitarily.

xmin = s(1);

xmax = s(1);

# Comparisons to get exact xmin and xmax.

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

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

# Call integral2 function to get the double integral.

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