MATLAB Programming/Nyquist Plot
Introduction[edit | edit source]
This article is on the topic of creating Nyquist plots in MATLAB. The quick answer is use the nyquist command. However, the Nyquist command has several options and the plots generated by the nyquist command are not easily reformatted. The default formatting of most MATLAB plots is good for analysis but less than ideal for dropping into Word and PowerPoint documents or even this website. As a result this article presents an alternative that requires more lines of code but offers the full formatting flexibility of the generic plot command.
MATLAB's Nyquist Command[edit | edit source]
The basic Nyquist command is as follows
The Nyquist command will automatically call gcf which will put the Nyquist plot on the current figure. If no figure exists then one is created by gcf.
>> freqVec = logspace(-1, 3, 5000); >> nyquist(LTI_SYS, freqVec * (2*pi))
- freqVec is a vector of 5000 frequencies, in Hz, spaced evenly on a log scale from 10-1 to 103
- pi is a MATLAB constant equal to the value of and in this case it is used to convert freqVec to rad/sec as it is passed to the nyquist command
Issues with the nyquist command[edit | edit source]
The main issue with the nyquist command is reformatting of the plot. The nyquist command appears to use a normal semilogx plot and then apply patches or something similar to the figure. This can lead to odd behavior when attempting to create multi-line titles, reformat line widths or font sizes, etc. The normal relationship of axes to figure is just not quite present.