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

    %% Interpolate Scalar Stationary Results Using Query Matrix
% Solve a scalar stationary problem and interpolate the solution to a dense
% grid.
%%
% Create the solution to the problem $- \Delta u = 1$ on the L-shaped
% membrane with zero Dirichlet boundary conditions.
model = createpde;
geometryFromEdges(model,@lshapeg);
applyBoundaryCondition(model,'dirichlet','edge',1:model.Geometry.NumEdges,'u',0);
specifyCoefficients(model,'m',0,'d',0,'c',1,'a',0,'f',1);
generateMesh(model,'Hmax',0.05);
results = solvepde(model);
%%
% Interpolate the solution on the grid from –1 to 1 in each
% direction.
v = linspace(-1,1,101);
[X,Y] = meshgrid(v);
querypoints = [X(:),Y(:)]';
uintrp = interpolateSolution(results,querypoints);
%%
% Plot the resulting interpolation on a mesh.
uintrp = reshape(uintrp,size(X));
mesh(X,Y,uintrp)
xlabel('x')
ylabel('y')