www.gusucode.com > pde 案例源码 matlab代码程序 > pde/cfunc.m

    function c = cfunc(p,t,u,time)

% Triangle point indices
it1 = t(1,:);
it2 = t(2,:);
it3 = t(3,:);

% Find centroids of triangles
xpts = (p(1,it1) + p(1,it2) + p(1,it3))/3;
ypts = (p(2,it1) + p(2,it2) + p(2,it3))/3;

c = 1 + xpts.^2 + ypts.^2;
end