Answered step by step
Verified Expert Solution
Question
1 Approved Answer
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.
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 separatelyStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started