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

    %% Surface Plot
% This example shows how to obtain a surface plot of a solution with 3-D
% geometry and N > 1.
%
% Import a tetrahedral geometry to a model with N = 2 equations and view
% its faces.
model = createpde(2);
importGeometry(model,'Tetrahedron.stl');
pdegplot(model,'FaceLabels','on','FaceAlpha',0.5)
view(-40,24)
%%
% Create a problem with zero Dirichlet boundary conditions on face 4.
applyBoundaryCondition(model,'dirichlet','face',4,'u',[0,0]);
%%
% Create coefficients for the problem, where |f = [1;10]| and |c| is a
% symmetric matrix in 6N form.
f = [1;10];
a = 0;
c = [2;0;4;1;3;8;1;0;2;1;2;4];
specifyCoefficients(model,'m',0,'d',0,'c',c,'a',a,'f',f);
%%
% Create a mesh for the solution.
generateMesh(model);
%%
% Solve the problem.
results = solvepde(model);
u = results.NodalSolution;
%%
% Plot the two components of the solution.
pdeplot3D(model,'ColorMapData',u(:,1))
view(-175,4)
title('u(1)')

figure
pdeplot3D(model,'ColorMapData',u(:,2))
view(-175,4)
title('u(2)')