Question: Develop an M-file function to implement Romberg integration based on Fig. 20.2. Test the function by using it to determine the integral of the polynomial
Develop an M-file function to implement Romberg integration based on Fig. 20.2. Test the function by using it to determine the integral of the polynomial from Example 20.1. Then use it to solve Prob. 20.1.
Fig.20.2
![function [q, ea, iter] =romberg (func, a, b, es, maxit, varargin) romberg:](https://dsd5zvtm8ll6.cloudfront.net/si.question.images/images/question_images/1679/0/4/0/8106414212a97eee1679040808493.jpg)
Example 20.1

Data From Problem 20.1
Use Romberg integration to evaluate

to an accuracy of εs = 0.5%.Your results should be presented in the format of Fig. 20.1. Use the analytical solution of the integral to determine the percent relative error of the result obtained with Romberg integration. Check that εt is less than εs.
function [q, ea, iter] =romberg (func, a, b, es, maxit, varargin) romberg: Romberg integration quadrature q = romberg (func, a, b, es, maxit, p1, p2, ...): Romberg integration. 8 f & input: 8 func = name of function to be integrated a, b = integration limits 8 es = desired relative error (default = 0.000001%) & maxit = maximum allowable iterations (default = 30) 8 & pl, p2, ... = additional parameters used by func & output: q= integral estimate 8 8 ea = approximate relative error (8) iter = number of iterations if nargin
Step by Step Solution
3.42 Rating (152 Votes )
There are 3 Steps involved in it
To implement Romberg integration and apply it to the given problems lets create an Mfile function ba... View full answer
Get step-by-step solutions from verified subject matter experts
