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

Write a function called approxiinatelntegral that uses a loop to compute a numer

ID: 644409 • Letter: W

Question

Write a function called approxiinatelntegral that uses a loop to compute a numerical approximation that adaptively changes Ax to smaller and smaller step sizes, until the approximation is accurate and precise within the number of decimal points defined by precision (difference between approx.1 and approx, must be less than 1 x 10^-precision). For example, you may test your function by assuming a starting value of delta x = 1 and decrease the step size from there for each refinement step. I.e. the value for refinement may be 1/10th, asking you to decrease delta x by this factor for each iteration step. Show the results of your refinement in tabular form (you may use fprintf), by displaying deltax and the corresponding numerical approximation to the integral in the command window. The function should also return the content of this table in matrix form. I.e. a matrix containing the current Ax and the numerical approximation to the integral (res [dxi; approx.]). function res = approximatelntegral(dx, refinement, precision) Notes: 1. Assume dx is less than or equal to 1. 2. Assume refinement is less than or equal to dx. 3. Assume precision is an integer. 4. You do need additional conditional statements testing the validity of the input arguments.

Explanation / Answer

function [dx,i] = approximateIntegral(dx,r,pre)

   pre1=dx/pre;
   for i from 1 downto pre1 step r do
  
       dx=dx-r;
   end_for

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