# Documentation

### This is machine translation

Translated by
Mouseover text to see original. Click the button below to return to the English verison of the page.

# `ztrans`

MATLAB live scripts support most MuPAD functionality, though there are some differences. For more information, see Convert MuPAD Notebooks to MATLAB Live Scripts.

## Syntax

```ztrans(`f`, `k`, `z`)
```

## Description

`ztrans(f, k, z)` computes the Z transform of the expression `f = f(k)` with respect to the index `k` at the point `z`.

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

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

If `ztrans` cannot find an explicit representation of the transform, it returns an unevaluated function call. See Example 4.

If `f` is a matrix, `ztrans` applies the Z transform to all components of the matrix.

To compute the inverse Z transform, use `iztrans`.

## Examples

### Example 1

Compute the Z transform of these expressions:

`ztrans(1/k!, k, z)`

`ztrans(sin(k), k, z)`

### Example 2

Compute the Z transform of this expression and then simplify the result:

`ztrans(cos(a*k + b), k, z)`

`Simplify(%)`

### Example 3

Compute the Z transform of this expression with respect to the variable `k`:

`F := ztrans(2*k + 3, k, z)`

Evaluate the Z transform of the expression at the points z = 2 a + 3 and z = 1 + i. You can evaluate the resulting expression `F` using `|` (or its functional form `evalAt`):

`F | z = 2*a + 3`

Also, you can evaluate the Z transform at a particular point directly:

`ztrans(2*k + 3, k, 1 + I)`

### Example 4

If `ztrans` cannot find an explicit representation of the transform, it returns an unevaluated call:

`ztrans(f(k), k, z)`

`iztrans` returns the original expression:

`iztrans(%, z, k)`

### Example 5

Compute the following Z transforms that involve Kronecker's Delta function and the Heaviside function:

```ztrans(f(k)*kroneckerDelta(k, 1) + g(k)*kroneckerDelta(k, -5), k, z)```

`ztrans(binomial(k, 2)*heaviside(5 - k), k, z)`

Simplify the last expression using `simplify`:

`simplify(%)`

### Example 6

Compute the Z transforms of this expression that involves the Heaviside function:

`ztrans(heaviside(k - 3), k, z)`

Note that MuPAD® uses the value ```heaviside(0) = 1/2```. You can define a different value for `heaviside(0)`:

```unprotect(heaviside): heaviside(0) := 1:```

For better performance, MuPAD remembers the previously computed value of the Z transform. To force the system to recalculate the transform, clear its remember table:

`ztrans(Remember, Clear):`

For details about the remember mechanism, see Remember Mechanism.

Defining a different value for `heaviside(0)` produces a different value of the Z transform:

`ztrans(heaviside(k - 3), k, z)`

For further computations, restore the original value:

```heaviside(0):= 1/2: protect(heaviside):```

### Example 7

Compute the Z tranforms of these expressions:

`ztrans(k*f(k), k, z)`

`ztrans(f(k + 1), k, z)`

## Parameters

 `f` Arithmetical expression or matrix of such expressions `k` `z` Arithmetical expression representing the evaluation point

## Return Values

Arithmetical expression or unevaluated function call of type `ztrans`. An explicit result can be a `piecewise` object. If the first argument is a matrix, the result is returned as a matrix.

`f`