Question: Your Task Clearly, using the Midpoint Method with more than a few rectangles is difficult due to the large number of calculations involved. However, MATL.AB

 Your Task Clearly, using the Midpoint Method with more than a

Your Task Clearly, using the Midpoint Method with more than a few rectangles is difficult due to the large number of calculations involved. However, MATL.AB can be uted to quickly perform thene calculations, even for very large n. In this problem you will define a MATLAB function, midpoint. that accepts four inputa: - a, the left interval endpoint - b, the right interval endpoint - ns the number of rectangles - f, a haridle lo a numeric MATLAB function- here is an anonymous function and returns one output: - A, the area approximated using the Midpoint method. The function declaration has already been provided in the solution template. Complete the function definition by following the ateps below: 1. Compute the rectangle width, Deltax, using the inputs a, b, and n according to the formula above. 2. Use the Hinspace function to generate a vector of n equally spaced points between a and b, nidpoints. (Hint: your interyal of the midpoints should not start and end at a and b, respectively.) 3. Obtain the vector of rectangle heights, hef ghts, by evaluating the input function at aidpoints. 4. Obtain the vevtor ot rectangle areas, areas, by multiplying the rectangle heights by the rectangle width, Del tax. 5. Sum the vector of rectangle areas using the suis function to obtain the Midpoint Method area estimate, An. Code has been provided to lest your function using the existing code in the Code to Coll Your Function Box. it will call nidpoint to estimate the area for fiti = it on [0,1] for n=10,100, and 1000 . The outputs should approach the true value, 31. If they do, submit your function for assesament

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!