Question: Write a Matlab program to do Gauss Legendre Quadrature Integration using the following approach. Program Input The program will read a three line input file,

Write a Matlab program to do Gauss Legendre Quadrature Integration using the following approach.

Write a Matlab program to do Gauss Legendre Quadrature Integration using the

Program Input The program will read a three line input file, with comma separated values Line 1 - number of elements, global X location of the starting (leftmost) point, number of output points Line 2-list of the lengths of the elements (# of values should match line l 1st entry) . Line 3-6 values as coefficients for the polynomial being studied, resulting in a function of the form f(x)-C+C-xHG.x2HG.x'HG.x4 +G.x Program Output Output can be written directly or to a file. It does not need elaborate formatting, but should be readable For the first part, there should be an output line for each point (1 ine, 3 value). It will contain that number of equally spaced output points from the far left (1st line, 2ad value) to the right of the last element. For each point, list: Global X location, the element number it belongs to, the location in natural coordinates, and the value of fx) at this location. For the secod part categral of the polynomial fuaction over the lengrh of each element and print this value. Optionally, they can be summed for an integral over the entire range. Use three integration points (it is not necessary to compare using one and two integration points as originally described). Compare this to the exact solution. The exact solution can be part of the program or done separately. Program Input The program will read a three line input file, with comma separated values Line 1 - number of elements, global X location of the starting (leftmost) point, number of output points Line 2-list of the lengths of the elements (# of values should match line l 1st entry) . Line 3-6 values as coefficients for the polynomial being studied, resulting in a function of the form f(x)-C+C-xHG.x2HG.x'HG.x4 +G.x Program Output Output can be written directly or to a file. It does not need elaborate formatting, but should be readable For the first part, there should be an output line for each point (1 ine, 3 value). It will contain that number of equally spaced output points from the far left (1st line, 2ad value) to the right of the last element. For each point, list: Global X location, the element number it belongs to, the location in natural coordinates, and the value of fx) at this location. For the secod part categral of the polynomial fuaction over the lengrh of each element and print this value. Optionally, they can be summed for an integral over the entire range. Use three integration points (it is not necessary to compare using one and two integration points as originally described). Compare this to the exact solution. The exact solution can be part of the program or done separately

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!