5.0

5.0 | 1 rating Rate this file 12 Downloads (last 30 days) File Size: 2.79 KB File ID: #23204

2D Simpson's Integrator

by Whayne Padden

 

05 Mar 2009

Fully vectorised 2D integrator based on the Simpson's method

| Watch this File

File Information
Description

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)

MATLAB release MATLAB 7.3 (R2006b)
Other requirements On a system with 1GB memory you'll be restricted to less than 4096 intervals in each direction.
Tags for This File  
Everyone's Tags
Tags I've Applied
Add New Tags Please login to tag files.
Comments and Ratings (2)
28 Sep 2010 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;

09 Dec 2010 ehsan

I want to get 2Dimensional Integration from Images,but i couldn't find any code.
please would you help me.

Please login to add a comment or rating.
Tag Activity for this File
Tag Applied By Date/Time
mathematics Whayne Padden 06 Mar 2009 10:05:45
integration Whayne Padden 06 Mar 2009 10:05:45
simpsons method Whayne Padden 06 Mar 2009 10:05:45
2d Whayne Padden 06 Mar 2009 10:05:45
simpsons method Jit 02 Jun 2011 22:44:41
2d Sheng 16 Jun 2011 01:24:50

Contact us at files@mathworks.com