By Trapezoidal rule and Simpson's rule. approximation and error. f(x)=e^(2x), -1
New Matlab ideas . A For Loop Repeat the code between for and end' once for each number between 1 and N the fprintf statement. This is a formatted printing statement, which uses almost identical syntax to the C programming language. It is used here to format the output for display. You should be able to use this part of the program without modifying it. Parameters used in this program a,b: the limits or integration . x: the variable of integration . f: the integrand .N: the number of sub-intervals h: the width of each sub-interval T: the trapezoidal approximation IS: the Simpson approximation Your assignment After running the above example, do the following to hand in: (Consult the Matlab TA if you have any questions.) Approximate the integral of Answer the following questions . Run the code with N-16, N-32, and N-64 - For each approximation, when coes the resurt agree with the exact value of the integral to 4 digits? How much better is the Simpson's rule than the trapezoidal rule? Explain this resuit using the theory given in the textoook and in lecture. Be quantitatve. Calculate the ratios between the errors each time the number of points is doubled New Matlab ideas . A For Loop Repeat the code between for and end' once for each number between 1 and N the fprintf statement. This is a formatted printing statement, which uses almost identical syntax to the C programming language. It is used here to format the output for display. You should be able to use this part of the program without modifying it. Parameters used in this program a,b: the limits or integration . x: the variable of integration . f: the integrand .N: the number of sub-intervals h: the width of each sub-interval T: the trapezoidal approximation IS: the Simpson approximation Your assignment After running the above example, do the following to hand in: (Consult the Matlab TA if you have any questions.) Approximate the integral of Answer the following questions . Run the code with N-16, N-32, and N-64 - For each approximation, when coes the resurt agree with the exact value of the integral to 4 digits? How much better is the Simpson's rule than the trapezoidal rule? Explain this resuit using the theory given in the textoook and in lecture. Be quantitatve. Calculate the ratios between the errors each time the number of points is doubled