image thumbnail

2D Simpson's Integrator

version (2.79 KB) by Whayne Padden
Fully vectorised 2D integrator based on the Simpson's method


Updated 05 Mar 2009

View License

Fast, fully vectorised version of the Simpson's method for 2D domains. This code avoids the use of any for loops etc. For a given level of accuracy it can be an order of magnitude or more faster than dblquad.

Examples are provided within the code.


ans = simp2D('func',xs,xe,ys,ye,NX,NY)

Input parameters:

func - 2D function that accepts vector inputs (otherwise
incorrect results can occur)
xs, xe - x-limits of integration
ys, ye - y-limits of integration
NX - number of integration intervals in the x-direction (should be even)
NY - number of integration intervals in the y-direction (should be even)

Cite As

Whayne Padden (2021). 2D Simpson's Integrator (, MATLAB Central File Exchange. Retrieved .

MATLAB Release Compatibility
Created with R2006b
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!