# STEPZ

## Purpose:

Calculates the step response of a Z-transform.

## Syntax:

STEPZ(b, a, N, Fs)

(h, t) = STEPZ(b, a, N, Fs)

 b - A series. The numerator (i.e. zero) coefficients in ascending powers of z-1. a - A series. The denominator (i.e. pole) coefficients in ascending powers of z-1. N - Optional. An integer specifying the length of the output series. If not specified or empty, the length is determined by allowing the corresponding impulse response to decay to –120 dB or to display 5 periods if the output is not significantly damped. Fs - Optional. A real, the sample rate of the output. If rate(b) == rate(a), defaults to rate(b) else defaults 1.0.

## Alternate Syntax:

STEPZ(c, N, Fs)

(h, t) = STEPZ(c, N, Fs)

 c - A series. The system coefficients in cascaded bi-quad form. If c contains 2 columns, c is assumed to be in direct form, where the first column is b and the second column is a. N - Optional. An integer specifying the length of the output series. If not specified or empty, the length is determined by allowing the corresponding impulse response to decay to –120 dB or to display 5 periods if the output is not significantly damped. Fs - Optional. A real, the sample rate of the output. Defaults to rate(c).

## Returns:

A series, the step response of the system.

(h, t) = STEPZ(b, a) returns the step response h and the time values t as two separate series.

## Example:

Given:

The step response is:

For the time domain response of:

n = 0..4;

W1: stepz({1}, {1, -0.5}, 5)

W2: impz({1}, {1, -1.5, 0.5}, 5)

W3: 2 - 0.5^n

W1 == W2 == W3 == {1, 1.5, 1.75, 1.875}

W1 computes the step response directly from the system coefficients. W2 computes the step response from the transformed system coefficients. W3 computes the analytical step response.  All three series are identical.

## Example:

Given:

The step response is:

We can find the analytical step response from the residues and poles:

(r, p, k) = residuez({1, -2}, conv({1, -0.7, 0.1}, {1, -1}));

r == {-2.5, 5.0, -1.5}

p == { 1,   0.5,  0.2}

k == {}

Representing the time domain step response:

n = 0..20;

W1: -2.5 + 5 * 0.5^n -1.5 * 0.2^n;stem

W2: stepz({1, -2}, {1, -0.7, 0.1}, 21)

W3: w1 - w2;sety(-1.5, 1.5)

W1 contains 21 samples of the analytical step response as determined by the partial fraction expansion method.

W2 displays 21 samples of the calculated step response and W3 confirms that the difference is negligible.

## Remarks:

The input series represent the terms of the rational polynomial H(z) = b(z) / a(z) where:

 z = e jω complex frequency N = number of numerator terms M = number of denominator terms

If a[1] ≠ 1, the numerator and denominator terms are normalized by dividing each coefficient by a[1].

For stepz(c, N, Fs), the input c is assumed to be a single column of coefficients in cascaded bi-quad form. This is the output format of IIR filters designed by DADiSP/Filters and processed by the CASCADE function.

or equivalently:

where G is the system gain, bk and ak are the filter coefficients for the kth stage.

If c contains 2 columns, the coefficients are assumed to be in direct form, where the first column is b and the second column is a.

If there are no output arguments, the result is displayed in the current window as a stem plot.