Documentation

ztrans

Syntax

ztrans(f)
ztrans(f,transVar)
ztrans(f,var,transVar)

Description

ztrans(f) finds the Z-Transform of f using the default independent variable n and the default transformation variable z. If f does not contain z, ztrans uses symvar.

ztrans(f,transVar) uses the specified transformation variable transVar instead of z.

ztrans(f,var,transVar) uses the specified independent variable var and transformation variable transVar instead of n and z respectively.

Input Arguments

f

Symbolic expression, symbolic function, or vector or matrix of symbolic expressions or functions.

var

Symbolic variable representing the independent variable. 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.

transVar

Symbolic variable or expression representing the transformation variable. This variable is often called the "complex frequency variable".

Default: The variable z. If z is the independent variable of f, then the default transformation variable is the variable w.

Examples

Compute the Z-transform of this expression with respect to the variable k for the transformation variable 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 independent variable, 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 transformation variable, 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 independent variables and transformation variables.

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*1i)/(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]

More About

collapse all

Z-Transform

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

F(z)=n=0f(n)zn.

Tips

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

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

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

Introduced before R2006a

Was this topic helpful?