File Exchange

## 2D Simpson's Integrator

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

Updated 05 Mar 2009

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.

Useage:

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 (https://www.mathworks.com/matlabcentral/fileexchange/23204-2d-simpson-s-integrator), MATLAB Central File Exchange. Retrieved .

abc

Thanks a lot!

ehsan

I want to get 2Dimensional Integration from Images,but i couldn't find any code.

erick

very good work. but I have a question.
In your code, you gave out the odd series and even series as follows.
ixo = 2:2:NX;
ixe = 3:2:NX-1;
iyo = 2:2:NY;
iye = 3:2:NY-1;

if you choose 'o' as 'odd' , 'e' as 'even', the series 2:2:NX are even. so I think 'ixo = 2:2:NX' should be replaced by 'ixe = 2:2:NX'.

Is there a literal mistake, maybe the below code is right.
ixe = 2:2:NX;
ixo = 3:2:NX-1;
iye = 2:2:NY;
iyo = 3:2:NY-1;

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