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:

Example 20.1

Romberg integration quadrature q = romberg (func, a, b, es, maxit, p1,


Data From Problem 20.1

Use Romberg integration to evaluate

p2, ...): Romberg integration. 8 f & input: 8 func = name

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

1 Expert Approved Answer
Step: 1 Unlock

To implement Romberg integration and apply it to the given problems lets create an Mfile function ba... View full answer

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 Applied Numerical Methods Questions!