The Z-transform of a discrete sequence x(n) is a mathematical operation that is defined as the summation of the sequence weighted by powers of the complex variable z. Specifically, the Z-transform of a sequence x(n) is given by:

\(X(z) = \sum_{n=-\infty}^{\infty}x(n) z^{-n}\)

Z-transform is important in digital signal processing system and control system. It is used for frequency response analysis of a discrete system, solve difference equation to build the system, and for checking the stability of a system. Another application is in designing FIR(Finite Impulse Response) and IIR(Infinite Impulse Response) digital filters.

**FIR filter design with Z-transform**

The transfer function of FIR digital filter is given by the following equation:

H(z) = b(0) + b(1)z^(-1) + b(2)z^(-2) + ... + b(N-1)z^(-N+1)

where b(k) is the filter coefficient for tap k.

To design an FIR filter, we start by specifying the desired frequency response in terms of the desired magnitude and phase characteristics. We then use the inverse Z-transform to derive the time-domain impulse response of the filter.

The impulse response can be written in terms of the filter coefficients as:

h(n) = b(0)delta(n) + b(1)delta(n-1) + b(2)delta(n-2) + ... + b(N-1)delta(n-N+1)

where delta(n) is the discrete-time unit impulse function.

Finally, we can implement the FIR filter by convolving the input signal with the impulse response.

So, in summary, the Z-transform is used to derive the transfer function of an FIR filter, and the inverse Z-transform is used to derive the filter's impulse response, which can then be used to implement the filter.

**IIR filter design with Z-transform**

The Z-transform can be used to design IIR (infinite impulse response) filters as well. IIR filters have a feedback structure, which means that the output of the filter is fed back into the input. This feedback structure causes the filter to have an infinite impulse response, unlike FIR filters, which have a finite impulse response.

The transfer function of an IIR filter can be expressed as a ratio of two polynomials in z, where the numerator and denominator polynomials are generally of different degrees. The denominator polynomial represents the filter's feedback structure, and the numerator polynomial represents the feedforward structure.

H(z) = Y(z)/X(z) = b(0) + b(1)z^(-1) + ... + b(M)z^(-M) / 1 + a(1)z^(-1) + ... + a(N)z^(-N)

where M is the degree of the numerator polynomial, N is the degree of the denominator polynomial, and a(1) through a(N) and b(0) through b(M) are the filter coefficients.

To design an IIR filter, we start by specifying the desired frequency response in terms of the desired magnitude and phase characteristics. We can then use various design techniques, such as the bilinear transform or the impulse invariant method, to derive the filter coefficients a(1) through a(N) and b(0) through b(M) from the desired frequency response.

Once we have the filter coefficients, we can use the transfer function to analyze the filter's frequency response and stability properties, and we can implement the filter using various techniques, such as direct form, cascade form, or parallel form.

So, in summary, the Z-transform can be used to design IIR filters by deriving the transfer function of the filter from the desired frequency response and using various design techniques to determine the filter coefficients.

**References**

[1] FIR filter design by frequency sampling

[1] What is Discrete Fourier Transform(DFT)

[2] DFT in Matlab without built-in function