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

    %% 2-D PDE Using [p,e,t] Mesh
% Solve a 2-D PDE using the older syntax for mesh.
%%
% Create a circle geometry.
g = @circleg;
%%
% Set zero Dirichlet boundary conditions.
b = @circleb1;
%%
% Create a mesh for the geometry.
[p,e,t] = initmesh(g);
%%
% Solve the PDE $- \nabla \cdot \left( c \nabla u \right) + au = f$ with
% parameters |c = 1|, |a = 0|, and |f = sin(x)|.
c = 1;
a = 0;
f = 'sin(x)';
u = assempde(b,p,e,t,c,a,f);
%%
% Plot the solution.
pdeplot(p,e,t,'XYData',u)