# Documentation

## Z-Transforms

 Note:   Use only in the MuPAD Notebook Interface. This functionality does not run in MATLAB.

The Z-transform of the function `F(z)` is defined as follows:

$F\left(z\right)=\sum _{k=0}^{\infty }\frac{f\left(k\right)}{{z}^{k}}$

If `R` is a positive number, such that the function `F(Z)` is analytic on and outside the circle ```|z| = R```, then the inverse Z-transform is defined as follows:

$f\left(k\right)=\frac{1}{2\pi i}\underset{|z|=R}{\oint }F\left(z\right){z}^{k-1}dz,\text{ }k=0,1,2...$

You can consider the Z-transform as a discrete equivalent of the Laplace transform.

To compute the Z-transform of an arithmetical expression, use the `ztrans` function. For example, compute the Z-transform of the following expression:

`S := ztrans(sinh(n), n, z)`

If you know the Z-transform of an expression, you can find the original expression or a mathematically equivalent form by computing the inverse Z-transform. To compute the inverse Z-transform, use the `iztrans` function. For example, compute the inverse Z-transform of the expression `S`:

`iztrans(S, z, n)`

Suppose, you compute the Z-transform of an expression, and then compute the inverse Z-transform of the result. In this case, MuPAD® can return an expression that is mathematically equivalent to the original one, but presented in a different form. For example, compute the Z-transform of the following expression:

`C := ztrans(exp(n), n, z)`

Now, compute the inverse Z-transform of the resulting expression `C`. The result differs from the original expression:

`invC := iztrans(C, z, n)`

Simplifying the resulting expression `invC` gives the original expression:

`simplify(invC)`

Besides arithmetical expressions, the `ztrans` and `iztrans` functions also accept matrices of arithmetical expressions. For example, compute the Z-transform of the following matrix:

```A := matrix(2, 2, [1, n, n + 1, 2*n + 1]): ZA := ztrans(A, n, z)```

Computing the inverse Z-transform of `ZA` gives the original matrix `A`:

`iztrans(ZA, z, n)`

The `ztrans` and `iztrans` functions let you evaluate the transforms of an expression or a matrix at a particular point. For example, evaluate the Z-transform of the following expression for the value `z = 2`:

`ztrans(1/n!, n, 2)`

Evaluate the inverse Z-transform of the following expression for the value `n = 10`:

`iztrans(z/(z - exp(x)), z, 10)`

If MuPAD cannot compute the Z-transform or the inverse Z-transform of an expression, it returns an unresolved transform:

`ztrans(f(n), n, z)`

`iztrans(F(z), z, n)`