function b=femval_stat(x,y,expr,femstr) %FEMVAL_STAT % B = FEMVAL_STAT(X,Y,EXPR,FEMSTR) returns the values B of % the expression EXPR for the FEM-structure with the name FEMSTR % at points specified by X and Y. The FEM-structure with the name % FEMSTR must be present in the main MATLAB work space and have % a solution, that is, a field sol.u. % % Note that the mesh for the current model using FEMVAL_STAT does not % need to be the same as the mesh in the FEM-structure with the name % FEMSTR. Values of B for coordinates that are outside the mesh % will be NaN. % % Example: % Given a FEM-structure fem1 in the main MATLAB work space with a solution % and defining the variable ux on subdomain level. Another model % in the GUI is loaded, possibly with a different mesh. In this model, % a PDE coefficient, boundary coefficient, or initial value can be set % to 'femval_stat(x,y,'ux','fem1')'. An expression including femval_stat % can also be used directly in the expressions in the post mode dialog boxes. % % Cautionary: % FEMVAL_STAT and FEMVAL_TIME take x and y as input and uses postinterp % on these points. This means that for coordinates being mesh nodes % between elements with a discontinuity between them, postinterp will % just "choose" the value from one of the elements. This can be a % problem when trying to plot discontinuities using these functions in, % e.g., POSTPLOT, or entering them in the Plot Parameters dialog box. % However, when integrating with POSTINT, or using the Integration dialog % boxes, evaluation is only done in internal points, so no such coordinates % will be passed to FEMVAL_STAT and FEMVAL_TIME, hence this is not a problem. % % See also FEMVAL_TIME. oldfem=evalin('base',femstr); b=postinterp(oldfem,expr,[x(:)';y(:)']); b=reshape(b,size(x));