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

    %% Dirichlet Boundary Conditions
% Create a PDE model and geometry.
model = createpde(1);
R1 = [3,4,-1,1,1,-1,-.4,-.4,.4,.4]';
g = decsg(R1);
geometryFromEdges(model,g);
%%
% View the edge labels.
pdegplot(model,'EdgeLabels','on')
xlim([-1.2,1.2])
axis equal
%%
% Apply zero Dirichlet condition on the edge 1.
applyBoundaryCondition(model,'dirichlet','Edge',1,'u',0);
%%
% On other edges, apply Dirichlet condition |h*u = r|, where |h = 1| and |r
% = 1|.
applyBoundaryCondition(model,'dirichlet','Edge',2:4,'r',1,'h',1);