matlab - Integrating Velocity Over a Complex 2-D Surface -


i'm using matlab calculate the average velocity in cross section of pipe integrating discrete velocity points on surface. points scattered in random pattern form circle (almost).

i used scatteredinterpolant create function relating x , y v (velocity) in order create grid of interpolated values.

f = scatteredinterpolant(x, y, v,'linear');  vq = f(xq,yq); % xq , yq set of query points 

the problem having trying calculate the surface area of function, in circular portion contains scatter points.

the first way went using quad2d function.

int = quad2d(@(x,y) f(x,y), min(x), max(x), min(y), max(y), 'maxfunevals', 100000); 

however gives incorrect takes area on rectangle , circle.

now can define surface area circle in future have work more complex shapes want use points define boundary of scatter points.

i'm doing through triangulation, using following command.

dt = delaunaytriangulation(x,y); 

however have no idea how can incorporate these points quad2d function. hoping might have suggestion or possibly method use in calculating area on these complex surfaces.

thanks!

you assume function piecewise linear on integration area , integrate using midpoint quadrature rule:

for every triangle compute midpoint value mean of nodal values , multiply triangle's area. sum integral.

function int = integrate(t, values)     meanontriangle = mean(values(t.connectivitylist),2);     int = sum(getelementareas(t).*meanontriangle);         end  function areas = getelementareas(t)     x = @(d) t.points(t.connectivitylist(:,d),:);     d21 = x(2)-x(1);     d31 = x(3)-x(1);     areas = abs(1/2*(d21(:,1).*d31(:,2)-d21(:,2).*d31(:,1))); end 

as goal average velocity, want compute following quantity:

averagevelocity = integrate(dt,v)/sum(getelementareas(dt)); 

Comments

Popular posts from this blog

facebook - android ACTION_SEND to share with specific application only -

python - Creating a new virtualenv gives a permissions error -

javascript - cocos2d-js draw circle not instantly -