Accelerating the pace of engineering and science

# ztrans

## Syntax

ztrans(f,trans_index,eval_point)

## Description

ztrans(f,trans_index,eval_point) computes the Z-transform of f with respect to the transformation index trans_index at the point eval_point.

## Input Arguments

 f Symbolic expression, symbolic function, or vector or matrix of symbolic expressions or functions. trans_index Symbolic variable representing the transformation index. This variable is often called the "discrete time variable". Default: The variable n. If f does not contain n, then the default variable is determined by symvar. eval_point Symbolic variable or expression representing the evaluation point. This variable is often called the "complex frequency variable". Default: The variable z. If z is the transformation index of f, then the default evaluation point is the variable w.

## Examples

Compute the Z-transform of this expression with respect to the transformation index k at the evaluation point x:

```syms k x
f = sin(k);
ztrans(f, k, x)```
```ans =
(x*sin(1))/(x^2 - 2*cos(1)*x + 1)```

Compute the Z-transform of this expression calling the ztrans function with one argument. If you do not specify the transformation index, ztrans uses the variable n.

```syms a n x
f = a^n;
ztrans(f, x)```
```ans =
-x/(a - x)```

If you also do not specify the evaluation point, ztrans uses the variable z:

`ztrans(f)`
```ans =
-z/(a - z)```

Compute the following Z-transforms that involve the Heaviside function and the binomial coefficient:

```syms n z
ztrans(heaviside(n - 3), n, z)```
```ans =
(1/(z - 1) + 1/2)/z^3```
`ztrans(nchoosek(n, 2)*heaviside(5 - n), n, z)`
```ans =
z/(z - 1)^3 + 5/z^5 + (6*z - z^6/(z - 1)^3 + 3*z^2 + z^3)/z^5```

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

```syms f(n) z
F = ztrans(f, n, z)```
```F =
ztrans(f(n), n, z)```

iztrans returns the original expression:

`iztrans(F, z, n)`
```ans =
f(n)```

Find the Z-transform of this matrix. Use matrices of the same size to specify the transformation variable and evaluation point.

```syms a b c d w x y z
ztrans([exp(x), 1; sin(y), i*z],[w, x; y, z],[a, b; c, d])```
```ans =
[                (a*exp(x))/(a - 1),       b/(b - 1)]
[ (c*sin(1))/(c^2 - 2*cos(1)*c + 1), (d*i)/(d - 1)^2]```

When the input arguments are nonscalars, ztrans acts on them element-wise. If ztrans is called with both scalar and nonscalar arguments, then ztrans expands the scalar arguments into arrays of the same size as the nonscalar arguments with all elements of the array equal to the scalar.

```syms w x y z a b c d
ztrans(x,[x, w; y, z],[a, b; c, d])```
```ans =
[   a/(a - 1)^2, (b*x)/(b - 1)]
[ (c*x)/(c - 1), (d*x)/(d - 1)]```

Note that nonscalar input arguments must have the same size.

When the first argument is a symbolic function, the second argument must be a scalar.

```syms f1(x) f2(x) a b
f1(x) = exp(x);
f2(x) = x;
ztrans([f1, f2],x,[a, b])```
```ans =
[ a/(a - exp(1)), b/(b - 1)^2]```

expand all

### Z-Transform

The Z-transform of the expression f = f(n) is defined as follows:

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

### Tips

• If you call ztrans with two arguments, it assumes that the second argument is the evaluation point eval_point.

• If f is a matrix, ztrans acts element-wise on all components of the matrix.

• If eval_point is a matrix, ztrans acts element-wise on all components of the matrix.

• To compute the inverse Z-transform, use iztrans.