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

Given the following integral and its numerical approximation: Write a function c

ID: 644411 • Letter: G

Question

Given the following integral and its numerical approximation:

Write a function called solveIntegral

that takes a user defined ?x as its input and returns the result, i.e. the numerical approximation resulting from the computation. If the input dx cannot evenly increment from 1 to 2 (e.g. dx = 0.15), you may round to the nearest number of increments (e.g. dx = 0.15 has 6.67 increments which rounds to 7 increments or dx = 1/7).

function res = solveIntegral(dx).

Given the following integral and its numerical approximation: Write a function called solveIntegral that takes a user defined ?x as its input and returns the result, i.e. the numerical approximation resulting from the computation. If the input dx cannot evenly increment from 1 to 2 (e.g. dx = 0.15), you may round to the nearest number of increments (e.g. dx = 0.15 has 6.67 increments which rounds to 7 increments or dx = 1/7). function res = solveIntegral(dx).

Explanation / Answer

function res = solveIntegral( dx )


increment = 1/dx;

increment = ceil(increment);
dx = 1/increment;

res=0;
for i=1:dx:2
    res = res + sin(i)*dx/i;
end

end

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