www.gusucode.com > pde 案例源码 matlab代码程序 > pde/CompositePlotExample.m
%% Composite Plot % Plot the solution of a PDE in 3-D with the |'jet'| coloring and a mesh, % and include a quiver plot. Get handles to the axis objects. %% % Create a PDE model. Include the geometry of the built-in function % |lshapeg|. Mesh the geometry. model = createpde; geometryFromEdges(model,@lshapeg); generateMesh(model); %% % Set zero Dirichlet boundary conditions on all edges. applyBoundaryCondition(model,'dirichlet','Edge',1:model.Geometry.NumEdges,'u',0); %% % Specify coefficients and solve the PDE. specifyCoefficients(model,'m',0,... 'd',0,... 'c',1,... 'a',0,... 'f',1); results = solvepde(model) %% % Access the solution and its gradient at the nodal locations. u = results.NodalSolution; ux = results.XGradients; uy = results.YGradients; %% % Plot the solution in 3-D with the |'jet'| coloring and a mesh, and % include % the gradient as a quiver plot. h = pdeplot(model,'XYData',u,'ZData',u,... 'FaceAlpha',0.5,... 'FlowData',[ux,uy],... 'ColorMap','jet',... 'Mesh','on')