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

    %% View Coefficients
% A PDE model stores coefficients in its |EquationCoefficients| property.
% Suppose |model| is the name of your model. Obtain the coefficients:
%
%  coeffs = model.EquationCoefficients;
%
% To see the active coefficient assignment for a region, call the
% |findCoefficients| function. For example, create a model and view the
% geometry.
model = createpde();
geometryFromEdges(model,@lshapeg);
pdegplot(model,'FaceLabels','on')
ylim([-1.1,1.1])
axis equal
%%
% Specify constant coefficients over all the regions in the model.
specifyCoefficients(model,'m',0,'d',0,'c',1,'a',0,'f',2);
%%
% Specify a different |f| coefficient on each subregion.
specifyCoefficients(model,'m',0,'d',0,'c',1,'a',0,'f',3,'Face',2);
specifyCoefficients(model,'m',0,'d',0,'c',1,'a',0,'f',4,'Face',3);
%%
% Change the specification to have nonzero |a| on region 2.
specifyCoefficients(model,'m',0,'d',0,'c',1,'a',1,'f',3,'Face',2);
%%
% View the coefficient assignment for region 2.
coeffs = model.EquationCoefficients;
findCoefficients(coeffs,'Face',2)
%%
% This shows the "last assignment wins" characteristic.
%
% View the coefficient assignment for region 1.
findCoefficients(coeffs,'Face',1)
%%
% The active coefficient assignment for region 1 includes all three regions, though this assignment is no longer active for regions 2 and 3.