The `zpk` function in MATLAB creates zero-pole-gain (ZPK) models, which are a convenient way to represent linear time-invariant systems using their zeros, poles, and gain.
Here’s an example of how to use the `zpk` command in MATLAB:
% Define zeros, poles, and gain
zeros = [-1, -2];
poles = [-3, -4, -5];
gain = 6;
% Create the ZPK model
sys = zpk(zeros, poles, gain);
What is zpk?
The zero-pole-gain (ZPK) representation is a powerful mathematical tool used in control systems and signal processing to describe linear time-invariant (LTI) systems. This representation characterizes a system by its zeros, poles, and gain, which together define how the system behaves in response to various inputs. Understanding ZPK is crucial for system analysis, design, and control, as it directly influences system stability and performance.
Applications of zpk in MATLAB
In MATLAB, the ZPK representation is widely utilized for various applications, including:
- Designing and analyzing control systems.
- Modeling dynamic systems for simulation purposes.
- Implementing digital filtering techniques.
- Investigating the stability and transient response of systems.

Understanding the Zero-Pole-Gain Representation
Definition of Zeros, Poles, and Gain
Zeros are the values of the input that cause the output of the system to be zero. They determine the frequency response of the system and can impact stability and bandwidth.
Poles, on the other hand, are points in the complex plane where the system output becomes infinite. The positioning of poles affects system stability, transient response, and overall behavior.
Gain is a constant that scales the output of the system. It plays a significant role in the amplitude of the system's response and affects how the system reacts to inputs.
Mathematical Representation
The ZPK representation is mathematically expressed as:
\[ H(s) = K \cdot \frac{(s - z_1)(s - z_2) \ldots (s - z_m)}{(s - p_1)(s - p_2) \ldots (s - p_n)} \]
Where:
- \( H(s) \) is the transfer function of the system.
- \( K \) represents the gain.
- \( z_1, z_2, \ldots, z_m \) are the zeros.
- \( p_1, p_2, \ldots, p_n \) are the poles.
The stability of the system is determined by the location of the poles in the complex plane: if any poles lie in the right half-plane, the system is unstable.

Creating ZPK Models in MATLAB
Creating a ZPK Object
To create a ZPK model in MATLAB, you utilize the `zpk` function, specifying the zeros, poles, and gain. Here is a simple example:
% Example: Create ZPK model with zeros, poles, and gain
zeros_zpk = [-1, -2]; % Example zeros
poles_zpk = [-3, -4]; % Example poles
gain_zpk = 5; % Example gain
sys_zpk = zpk(zeros_zpk, poles_zpk, gain_zpk);
In this code:
- `zeros_zpk` defines the zeros of the system.
- `poles_zpk` defines the poles.
- `gain_zpk` sets the gain of the system.
- `sys_zpk` is the resulting ZPK model.
Visualizing ZPK Models
Visualizing the ZPK representation is crucial for understanding system behavior. You can use the `pzmap` function to plot the poles and zeros, illustrating their locations in the complex plane:
% Example: Plot the ZPK model
pzmap(sys_zpk);
title('Pole-Zero Map of the ZPK Model');
This plot helps engineers visualize potential stability issues based on pole placement and also conveys where the system's output might become zero.

Analyzing ZPK Systems
Step Response and Impulse Response
The step response and impulse response provide insights into the dynamic behavior of a system.
To analyze the step response of the ZPK model, you can use the following command:
% Step response of ZPK model
step(sys_zpk);
title('Step Response of the ZPK Model');
Similarly, to observe the impulse response, you can run:
% Impulse response of ZPK model
impulse(sys_zpk);
title('Impulse Response of the ZPK Model');
These commands generate plots that show how the system reacts over time to a step input and an impulse input, respectively. Understanding these responses is fundamental in assessing the performance of control systems.
Frequency Response Analysis
Bode plots are crucial for understanding the frequency response of ZPK systems. The frequency response indicates how the system responds at varying frequencies, which is critical in control system design.
To create a Bode plot for the ZPK model, use the following code:
% Bode plot of ZPK model
bode(sys_zpk);
title('Bode Plot of the ZPK Model');
The Bode plot displays both the magnitude and phase of the system's response, allowing engineers to evaluate system stability and gain margin.

Modifying ZPK Systems
Adding Zeros and Poles
Modifying a ZPK model is straightforward in MATLAB. You can add zeros or poles to an existing model as needed to refine system performance. For instance, adding a zero can be accomplished like this:
% Adding a zero to the existing ZPK model
new_zero = -0.5;
sys_mod = zpk([zeros_zpk, new_zero], poles_zpk, gain_zpk);
Understanding how these modifications affect system dynamics is essential for designing robust control systems.
Feedback Control with ZPK
Feedback loops are critical in control systems. They help ensure stability and improve performance. To analyze a closed-loop ZPK system with unity feedback, you can use the `feedback` function:
% Closed-loop ZPK system with unity feedback
sys_cl = feedback(sys_zpk, 1);
step(sys_cl);
title('Closed-loop Step Response of the ZPK Model');
By examining the closed-loop step response, you can evaluate the effectiveness of feedback in improving system stability and performance.

Conclusion
Mastering the zpk representation in MATLAB is an invaluable skill for anyone involved in control systems and signal processing. By understanding zeros, poles, and gain, as well as how to create, analyze, and modify ZPK models, you position yourself to design effective control systems. Continue exploring MATLAB’s capabilities to deepen your understanding and enhance your skills in utilizing ZPK for various applications.

Additional Resources
For further information and expertise on ZPK in MATLAB, consider reviewing the official MATLAB documentation and exploring recommended courses and books. Engaging with online MATLAB communities can also provide support and additional insights.