Question: Please explain using Matlab The aim of this lab is to code and test an adaptive two-point Gaussian integration algorithm. 3 sin10/x dx. Consider the

 Please explain using Matlab The aim of this lab is to

code and test an adaptive two-point Gaussian integration algorithm. 3 sin10/x dx.

Please explain using Matlab

The aim of this lab is to code and test an adaptive two-point Gaussian integration algorithm. 3 sin10/x dx. Consider the integral 1 Write 3 functions to develop an adaptive method for performing adaptive two-point Gaussian quadrature. (1). A basic two-point Gauss procedure Gauss(f, a,b) to approximate the integral b Sf(x)dx. a (2). A driving program (main) that initializes the variables sum and depth to zero, and calls the recursive procedure: Adaptive(f,sum, a,b,depth) (3). A recursive function Adaptivelf, sum,a,b,depth) that checks to see if the maximum depth is exceeded, and if so it prints an error message and stops. If the maximum depth is not exceeded, then the function continues by dividing the interval [a,b] in half, and calling the procedure Gauss on the left sub-interval, the right subinterval, and the whole interval, then checking to see if the tolerance test is accepted. If yes, then it adds the approximate value over the whole interval to the variable sum. Otherwise, it calls the recursive procedure Adaptive on the left and right subintervals and increases the value of the depth variable. The tolerance test checks to see if the difference in the absolute value between the approximate value over the whole interval and the sum of the approximate values over the left and right subintervals is less than a variable tolerance. Print out the contribution of each subinterval and the depth at which the approximate value over the subinterval is accepted. Use a maximum depth of 100 subintervals and use the tolerance of 10? ADAPTIVE GAUSSIAN QUADRATURE: Adaptive(f, sum a, b,level,N) INPUT endpoints a, b, the tolerance & , N (max depth) OUTPUT S, the approximation to the integral level=level+1 One_Gauss=Gauss(f,a,b) c=(a+b)/2 Two_Gauss=Gauss(f, a,c)+Gauss(f,c,b) If level > Then Print Error: Max Depth Reached Else If |One_Gauss-Two_Gauss

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!