Evaluating an Expression at Geometry Vertices
The function mphevalpoint returns the result of a given expression evaluated at the geometry points:
[d1,...] = mphevalpoint(model,{'e1',...})
where e1, … are the COMSOL expressions to evaluate. The output d1, … is an N-by-P double array, where N is the number of evaluation points and P the length of the inner solution.
The rest of this section has additional information for the function mphevalpoint:
Specify the Evaluation Data
The function mphevalpoint supports the following properties to set the data of the evaluation to perform:
dataset, specify the solution dataset to use in the evaluation:
data = mphevalpoint(model,<expr>,'dataset',<dsettag>)
<dsettag> is the tag of a solution dataset. The default value is the current solution dataset of the model.
selection, specify the domain selection for evaluation:
data = mphevalpoint(model,<expr>,'selection',<seltag>)
where <seltag> is the tag of a selection node to use for the data evaluation. <seltag> can also be a positive integer array that corresponds to the domain index list. The default selection is all domains where the expression is defined. If the evaluation point does not belong to the specified domain selection, the output value is NaN.
solnum, specify the inner solution number for data evaluation. Inner solutions are generated for the following analysis types: time domain, frequency domain, eigenvalue, or stationary with continuation parameters:
data = mphevalpoint(model,<expr>,'solnum',<solnum>)
where <solnum> is an integer array corresponding to the inner solution index. <solnum> can also be a string:'end' or 'all' to evaluate the expression for the last inner solution, or all inner solution respectively. By default the evaluation is performed on all inner solution.
outersolnum, specify the outer solution number for data evaluation. Outer solutions are generated with parametric sweeps:
data = mphevalpoint(model,<expr>,'outersolnum',<outersolnum>)
where <outersolnum> is a positive integer corresponding to the outer solution index. <outersolnum> can also be a string, 'all' or 'end', to evaluate the expression for all or the last outer solution respectively. The default settings use the first outer solution for the data evaluation.
data = mphevalpoint(model,<expr>,'t',<time>)
where <time> is a double array. The default value corresponds to all the stored time steps.
Perform a data series operation with the dataseries property:
data = mphevalpoint(model,<expr>,'dataseries',dataseries)
where dataseries is either 'mean', 'int', 'max', 'min', 'rms', 'std', or 'var'. Depending on the property value, mphevalpoint performs the following operations — mean, integral, maximum, minimum, root mean square, standard deviation, or variance, respectively.
When performing a minimum or maximum operation on the data series, you can specify to perform the operation using the real or the absolute value. Set the property minmaxobj to 'real' or 'abs', respectively:
data = mphevalpoint(model,<expr>,'dataseries',dataseries,... 'minmaxobj', valuetype)
By default valuetype is 'real'.
Output Format
The function mphevalpoint supports other output formats.
To extract the unit of the evaluated expression, define an extra output variable:
[data,unit] = mphevalpoint(model,<expr>)
with unit is a 1xN cell array where N is the number of expressions to evaluate.
By default, mphevalpoint returns the results as a squeezed singleton. To get the full singleton set the squeeze property to off:
data = mphevalpoint(model,<expr>,'squeeze','off')
Set the property matrix to off to return the data as a cell array instead of a double array:
data = mphevalpoint(model,<expr>,'matrix','off')