iztrans::addpattern

Add patterns for the inverse Z transform

Use only in the MuPAD Notebook Interface.

This functionality does not run in MATLAB.

Syntax

iztrans::addpattern(pat, z, k, res, <vars, <conds>>)

Description

iztrans::addpattern(pat, z, k, res) teaches iztrans to return iztrans(pat, z, k) = res.

The iztrans function uses a set of patterns for computing inverse Z transforms. You can extend the set by adding your own patterns. To add a new pattern to the pattern matcher, use iztrans::addpattern. MuPAD® does not save custom patterns permanently. The new patterns are available in the current MuPAD session only.

Variable names that you use when calling iztrans::addpattern can differ from the names that you use when calling iztrans. See Example 2.

You can include a list of free parameters and a list of conditions on these parameters. These conditions and the result are protected from premature evaluation. This means that you can use not   iszero(a^2 - b) instead of hold( _not @ iszero )(a^2 - b).

The following conditions treat assumptions on identifiers differently:

  • a^2 - b <> 0 takes into account assumptions on identifiers.

  • not   iszero(a^2 - b) disregards assumptions on identifiers.

See Example 3.

Environment Interactions

Calling iztrans::addpattern changes the expressions returned by future calls to iztrans.

Examples

Example 1

Compute the inverse Z transform of the function bar. By default, MuPAD does not have a pattern for this function:

iztrans(bar(z), z, k)

Add a pattern for the inverse Z transform of bar using iztrans::addpattern:

iztrans::addpattern(bar(z), z, k, foo(k)):

Now iztrans returns the inverse Z transform of bar:

iztrans(bar(z), z, k)

Example 2

Define the inverse Z transform of bar(y) using the variables x and y as parameters:

iztrans::addpattern(bar(y), y, x, foo(x))

The iztrans function recognizes the added pattern even if you use other variables as parameters:

iztrans(bar(z), z, k)

Example 3

Use assumptions when adding this pattern for the inverse Z transform:

iztrans::addpattern(BAR(x*z), z, k, FOO(k/(x - 1/2))*sin(x),
                                      [x], [abs(x) < 1]):
iztrans(BAR(x*z), z, k) assuming -1 < x < 1

If |x| ≥ 1, you cannot apply this pattern:

iztrans(BAR(x*z), z, k) assuming x >= 1

If MuPAD cannot determine whether the conditions are satisfied, it returns a piecewise object:

iztrans(BAR(x*z), z, k)

Note that the resulting expression defining the inverse Z transform of BAR(x*z) implicitly assumes that the value of x is not 1/2. A strict definition of the pattern is:

ztrans::addpattern(BAR(x*z), z, k, FOO(k/(x - 1/2))*sin(x),
                     [x], [abs(x) < 1, x <> 1/2]):

If either the conditions are not satisfied or substituting the values into the result gives an error, iztrans ignores the pattern. For this particular pattern, you can omit specifying the assumption x <> 1/2. If x = 1/2, MuPAD throws an internal "Division by zero." error and ignores the pattern:

iztrans(BAR(z/2), z, k)

Parameters

pat

Arithmetical expression in the variable z representing the pattern to match

z

Identifier used as a variable in the pattern

k

Identifier used as a variable in the result

res

Arithmetical expression in the variable k representing the pattern for the result of the transformation

vars

List of identifiers or indexed identifiers used as "pattern variables" (placeholders in pat and res). You can use pattern variables as placeholders for almost arbitrary MuPAD expressions not containing z or k. You can restrict them by conditions given in the optional parameter conds.

conds

List of conditions on the pattern variables

Return Values

Object of type DOM_NULL

See Also

MuPAD Functions

Related Examples

Was this topic helpful?