Question: 13. Write a user defined MATLAB function to compute the definite integral, intout, of a function f (x) in the limits x0 to xn with

 13. Write a user defined MATLAB function to compute the definite

13. Write a user defined MATLAB function to compute the definite integral, intout, of a function f (x) in the limits x0 to xn with an accuracy of sigfig significant digits using an n-segment composite trapezoidal rule as represented by the formula 12- X, -X, mm-1 1n , where IFine and Icoarse represents trapezoidal integrals evaluated with finer (n) and oa grids respectively, for a faster convergence. Your code needs to be capable of making a decision on grid refinements based on the desired accuracy. As discussed in class, start iterating with n = 1, and keep on doubling n until you reach the desired accuracy. This will make the step size h for the coarser grid calculation two times that of the finer grid calculation. Using this strategy, it was discussed in class that in each subsequent grid refinement, you need to evaluate the function f(xmh) only for the odd values of m. To start with, initialize IFine equal to the trapezoidal integral corresponding to n = 1 . The convergence criterion is based on the relative error in/Fine. Use your code to solve the following integrals with an accuracy of 14 significant digits. In all cases calculate the error and note down the number of iterations required to achieve the desired accuracy 1 = f4yT (t-2)dt ; Analytical solution, 1-84 1 = f zwww-3 (a) (b) dw; Analytical solution, I-32/15

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!