Search All of the Math Forum:
Views expressed in these public forums are not endorsed by
Drexel University or The Math Forum.



Re: compute a double integral over a pacth defined by discrete points(not a function) using matlab
Posted:
Dec 3, 2013 5:42 AM


sun <bianaib@gmail.com> writes: >Hello,=20 >I would like to compute a double integral of a function z=3Dx*y^2 over a no= >n rectangle regio which is defined by points(x,y).I tried to use meshgrid a= >nd than trapz but when the region is not defined by a rectangle, but for ex= >ample of a circle, or a kind of a leaf... the meshgrid places nodes out of = >the patch.=20 >Thank you,=20 >Sun for your situation there are several solutions: simplest one: cubpack from netlib/toms is a package for this (in C++), but this requires some preparation from your side of course. there are more and simpler codes for this, also in netlib/toms: toms868 toms706 (dcutri)
there is also a code twodqd (in f90) which however requires to transform your region in a collection of triangels beforehand. for this there is netlib/toms/624
If the region under consideration is simple (for example convex), you could try a handcrafted approach: cut it in normal areas of the kind
{(x,y): a<=x<=b , psi1(x)<=y<=psi2(x) } or similar with the roles of x and y interchanged where the functions psi* are obtained by interpolation of your given boundary points and then use repeated ordinary quadrature.
hth peter



