### 13.6.1 Z-transform of a sequence

The Z-transform of a sequence a0, a1, …, an, … is the function

f(z)=

∞
∑
n=0

an
zn

.

For example, the Z-transform of the sequence 0, 1, 2, 3, … is

f(z)=0+

1
z

+

2
z2

+

3
z3

+⋯

which has closed form

f(z)=

z
(z−1)2

.

The ztrans command finds the Z-transform of a sequence.

- ztrans takes one mandatory and two optional arguments:
  - ax, a formula with a variable for the general term of a sequence.
  - Optionally, x, the variable (by default x).
  - Optionally, z, a variable to be used by the resulting function.
  ztrans(ax⟨,x,z⟩) returns the Z-transform of the input sequence.

#### Examples

To find the Z-transform of the identity function:

ztrans(x)

x
x2−2 x+1

With n as the original variable and z as the transform variable:

ztrans(n,n,z)

z
z2−2 z+1

Find the Z-transform of the constant function f(x)=1:

ztrans(1)

x
x−1

Indeed:

∞
∑
n=0

1
xn

=

1

1−

1
x

=

x
x−1

.

You also have

ztrans(1,n,z)

z
z−1

Note that differentiating both sides of

∞
∑
n=0

1
zn

=

z
z−1

gives you

∞
∑
n=0

n
zn−1

=

1
(z−1)2

,

and so, multiplying both sides by z,

∞
∑
n=0

n
zn

=

z
(z−1)2

=

z
z2−2z+1

,

as indicated in the previous example.