Use a function handle to specify the following structural parameters when
they depend on space and, depending of the type of structural analysis, either time or
frequency:

Surface traction on the boundary

Pressure normal to the boundary

Concentrated force at a vertex

Distributed spring stiffness for each translational direction used to model
elastic foundation

Enforced displacement and its components

Initial displacement and velocity (can depend on space only)

For example, use function handles to specify the pressure load,
*x*-component of the enforced displacement, and the initial displacement
for this model.

For all parameters, except the initial displacement and velocity, the function must be of the
form:

For the initial displacement and velocity the function must be of the form:

The solver computes and populates the data in the `location`

and
`state`

structure arrays and passes this data to your function. You can
define your function so that its output depends on this data. You can use any names instead
of `location`

and `state`

, but the function must have
exactly two arguments (or one argument if the function specifies the initial displacement or
initial velocity). To use additional arguments in your function, wrap your function (that
takes additional arguments) with an anonymous function that takes only the
`location`

and `state`

arguments. For example:

`location`

— A structure containing these fields:

`location.x`

— The *x*-coordinate of
the point or points

`location.y`

— The *y*-coordinate of
the point or points

`location.z`

— For a 3-D or an axisymmetric geometry, the
*z*-coordinate of the point or points

`location.r`

— For an axisymmetric geometry, the
*r*-coordinate of the point or points

Furthermore, for boundary conditions, the solver passes these data in the
`location`

structure:

`location.nx`

— *x*-component
of the normal vector at the evaluation point or points

`location.ny`

— *y*-component
of the normal vector at the evaluation point or points

`location.nz`

— For a 3-D or an axisymmetric
geometry, *z*-component of the normal vector at the
evaluation point or points

`location.nz`

— For an axisymmetric geometry,
*z*-component of the normal vector at the evaluation
point or points

`state`

— A structure containing these fields for dynamic
structural problems:

`state.time`

and `state.frequency`

are
scalars.

Boundary constraints and loads get these data from the solver:

`location.x`

, `location.y`

,
`location.z`

, `location.r`

`location.nx`

, `location.ny`

,
`location.nz`

, `location.nr`

`state.time`

or `state.frequency`

(depending of
the type of structural analysis)

Initial conditions get these data from the solver:

If a parameter represents a vector value, such as surface traction, spring stiffness, force,
or displacement, your function must return a two-row matrix for a 2-D model and a three-row
matrix for a 3-D model. Each column of the matrix corresponds to the parameter value (a
vector) at the boundary coordinates provided by the solver.

If a parameter represents a scalar value, such as pressure or a displacement component, your
function must return a row vector where each element corresponds to the parameter value (a
scalar) at the boundary coordinates provided by the solver.

If boundary conditions depend on `state.time`

or
`state.frequency`

, ensure that your function returns a matrix of
`NaN`

of the correct size when `state.frequency`

or
`state.time`

are `NaN`

. Solvers check whether a
problem is nonlinear or time dependent by passing `NaN`

state values and
looking for returned `NaN`

values.