The Nyquist plot in MATLAB is a graphical representation of the frequency response of a system, showing the relationship between the real and imaginary parts of its transfer function.
Here's a simple code snippet to generate a Nyquist plot for a transfer function:
% Define the transfer function
num = [1]; % Numerator coefficients
den = [1, 3, 2]; % Denominator coefficients
sys = tf(num, den);
% Generate the Nyquist plot
nyquist(sys);
grid on;
What is the Nyquist Criterion?
The Nyquist criterion is a fundamental principle in control systems engineering and signal processing, serving as a critical tool for stability analysis. At its core, the Nyquist criterion helps determine whether a system is stable based on how its open-loop frequency response interacts with a specific contour in the complex plane.
In engineering, stability is paramount. Systems that oscillate uncontrollably or diverge can lead to failures, whether in mechanical systems, electronics, or feedback loops. The Nyquist criterion provides a systematic approach to predicting and proving stability.

Applications of Nyquist in Engineering
Nyquist analysis is instrumental in various domains, especially in control engineering and telecommunications. Engineers frequently employ it to assess:
- Stability analysis of control systems by understanding the relationships between input and output signals.
- Frequency response evaluation, which provides insights into how systems respond to different frequencies, crucial for designing filters and amplifiers.

Setting Up MATLAB for Nyquist Analysis
Installing MATLAB
Before diving into Nyquist plots, ensure that you have MATLAB installed. Follow these general steps to install it on your system:
- Go to the MathWorks website: Locate the appropriate version for your operating system.
- Download the installer: Follow the prompts and accept the license agreement.
- Select the required toolboxes: For Nyquist analysis, you should include the Control System Toolbox.
Basic MATLAB Commands for Nyquist
Familiarize yourself with some fundamental MATLAB commands that are used for generating Nyquist plots. The primary function for this is:
- `tf()`: Creates transfer function models.
- `nyquist()`: Generates the Nyquist plot of a linear system.

Creating Nyquist Plots in MATLAB
Understanding the Nyquist Plot
A Nyquist plot graphically represents the frequency response of a system. The plot displays gain and phase of the system as the frequency varies. Understanding how to read this plot is critical for assessing system stability and performance.
Step-by-Step Guide to Generate a Nyquist Plot
Step 1: Define the System
Begin by defining your system using its transfer function. For example, consider a simple first-order system characterized by a transfer function:
num = [1]; % Numerator coefficients
den = [1, 1]; % Denominator coefficients
sys = tf(num, den); % Transfer function
This code represents a system with a single pole at -1.
Step 2: Use the nyquist Function
Next, generate the Nyquist plot using the `nyquist` command:
nyquist(sys);
grid on; % Adds grid for better visibility
The `grid on` command enhances the plot by making it easier to identify stability margins.
Step 3: Customize Your Plot
Customizing your plot improves clarity and presentation. You can modify axis limits and add titles like this:
title('Nyquist Plot of the System');
xlim([-2 2]); % Set x-axis limits
ylim([-2 2]); % Set y-axis limits
Customize your plot to suit your specific data and make it more informative.

Analyzing Stability with Nyquist Plots
Interpreting the Resulting Plot
Understanding the Nyquist plot is crucial for assessing stability. If the plot encircles the critical point (-1, 0) on the real axis, the system is unstable. Conversely, if it does not, the system remains stable.
Gain and Phase Margins
Gain and phase margins provide quantitative measures of how much gain or phase variation the system can tolerate before it becomes unstable. You can calculate these margins in MATLAB using:
[Gm, Pm] = margin(sys); % Gain and phase margins
Where `Gm` is the gain margin, and `Pm` is the phase margin, both of which are critical for understanding the robustness of your system.
Case Studies
Example 1: Stable System
- A Nyquist plot showing the system does not encircle the (-1,0) point suggests stability. For instance, a simple first-order system typically indicates robust stability.
Example 2: Unstable System
- If the plot circles the (-1,0) point, it indicates instability. Consider a second-order system where poles are further in the right half of the complex plane resulting in oscillations.

Advanced Nyquist Plot Techniques
Multiple Systems on One Plot
To compare several systems visually, overlay multiple Nyquist plots on a single figure. For example:
sys2 = tf([2], [1, 3]); % Define another system
nyquist(sys, sys2);
legend('System 1', 'System 2');
This technique aids in evaluating how different system designs relate to each other regarding stability.
Nyquist for Nonlinear Systems
Analyzing nonlinear systems requires additional considerations, as Nyquist plots are fundamentally based on linear approximations. Tools like `linmod` can help convert a nonlinear system to a linear model at a specific operating point for analysis.
Using Bode Plots to Complement Nyquist Analysis
Bode plots can effectively supplement Nyquist analysis by providing another perspective of system behavior. Use the following command:
bode(sys);
Bode plots display frequency response via magnitude and phase, offering additional details about system dynamics not present in Nyquist plots alone.

Troubleshooting Common Issues
Common MATLAB Errors in Nyquist Analysis
Users often encounter errors related to system definitions or forgetting to include appropriate toolboxes. Ensure transfer functions are properly defined, and MATLAB has access to the Control System Toolbox.
Ensuring Accurate Plots
To guarantee accuracy:
- Double-check system definitions.
- Kstudy the scaling of the plot, ensuring it appropriately represents your system's properties.

Conclusion
The Nyquist criterion is a powerful tool for analyzing the stability of dynamic systems using MATLAB. By creating and interpreting Nyquist plots, you can ascertain critical insights into system behavior and robustness. As you progress, consider further exploring advanced topics or integrating complementary analysis techniques, such as Bode plots, to enhance your understanding and application of Nyquist analysis in MATLAB.

Additional Resources
To deepen your expertise in Nyquist and MATLAB:
- Recommended books encompass classic references on control theory and MATLAB applications.
- Online communities, like MATLAB Central and relevant forums, are excellent for discussing problems and sharing insights with other MATLAB users.