File Exchange

image thumbnail

Romberg

version 1.3 (2.35 KB) by Mazin Mustafa
Performs Romberg integration

28 Downloads

Updated 13 Jan 2019

View Version History

View License

Call Romberg.m to perform Romberg integration with specified tolerance and gives results
Call RombergDisp.m to display Romberg integration scheme coefficients
Icon image: An Introduction to Numerical Methods and Analysis, 2nd Edition
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
function [I] = Romberg(func,a,b,tol,kmax)
Romberg integrates function "func" of one variable and nonsingular
from "a" to "b" with tolerance "tol" and maximum order of "kmax".
0 < tol < 1 & kmax > 0. Using Romberg integration.
I = Romberg(@func,a,b,tol,kmax)
I = Romberg(@func,a,b,tol) , default kmax = 15
I = Romberg(@func,a,b) , default tol = 1e-10 , default kmax = 15
e.g.
I = Romberg(@sin,0,pi)
I = 2.000000000000000
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
function [] = RombergDisp(func,a,b,k)
Romberg integrates function "func" of one variable and nonsingular
from "a" to "b" with order of "k" and displays all results.
k >= 0. Using Romberg integration.
I = RombergDisp(@func,a,b,k)
e.g.
RombergDisp(@sin,0,pi,2)
0.000000000000000
1.570796326794897 2.094395102393195
1.896118897937040 2.004559754984421 1.998570731823836

Cite As

Mazin Mustafa (2020). Romberg (https://www.mathworks.com/matlabcentral/fileexchange/58286-romberg), MATLAB Central File Exchange. Retrieved .

Comments and Ratings (4)

Pit Max

Pit Max

Mazin Mustafa

To Anthony Wright
Can you write an example of what you are trying to do?

Anthony Wright

keeps giving an error when publishing:

Error in Romberg (line 9)
kmax=abs(kmax);

MATLAB Release Compatibility
Created with R2016a
Compatible with any release
Platform Compatibility
Windows macOS Linux

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!