
Re: compute a double integral over a pacth defined by discrete points(not a function) using matlab
Posted:
Dec 3, 2013 7:06 PM


On Tuesday, December 3, 2013 4:42:50 AM UTC6, Peter Spellucci wrote: > sun <bianaib@gmail.com> writes: > > >Hello,=20 > > >I would li0, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 20, 22, 24, 26, 28, 31, 34, 37, 41, 45, 49, 54, 60, 66, 73, 81, 90, 100 9, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 3, 3, 3, 4, 4, 5, 6, 6, 7, 8, 9 , 10 ke 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 jesus

