Alan_Weiss <aweiss@mathworks.com> wrote in message <ksp9bm$s23$1@newscl01ah.mathworks.com>...
> On 7/24/2013 1:18 PM, Meng wrote:
> > Alan_Weiss <aweiss@mathworks.com> wrote in message
> > <ksoi2f$m61$1@newscl01ah.mathworks.com>...
> >> On 7/23/2013 9:48 PM, Meng wrote:
> >> > When I use [ux,uy]=pdegrad(p,t,u); ux and uy are calculated in the
> >> > center of each triangle. But how can I get the coordinates of the >
> >> center in each triangle?
> >> This is documented here, among other places:
> >> http://www.mathworks.com/help/pde/ug/scalarcoefficientsinfunctionform.html
> >>
> >>
> >> Here is a relevant code snippet:
> >>
> >> % 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;
> >>
> >> Alan Weiss
> >> MATLAB mathematical toolbox documentation
> >
> >
> > Thank you very much! Another question is that Cp is calculated at the
> > center of each triangle. How can I get the gradient of Cp ( d(Cp)/dx)?
>
> I don't know what Cp is. But perhaps you can use (I didn't test this,
> use caution):
>
> Cpn = pdeprtni(p,t,Cp);
> [Cpx,Cpy] = pdegrad(p,t,Cpn);
>
> Alan Weiss
> MATLAB mathematical toolbox documentation
>
> Alan Weiss
> MATLAB mathematical toolbox documentation
Thank you very much! It does work.:)
Meng Wang
