Plotting Imaginary and Complex Data

When the arguments to plot are complex (i.e., the imaginary part is nonzero), All MATLAB® graphics functions ignore the imaginary part except when plot is given a single complex data argument. For this special case, the command produces a plot of the real part versus the imaginary part. Therefore,

plot(Z)

where Z is a complex vector or matrix, is equivalent to

plot(real(Z),imag(Z))

For example, this statement plots the distribution of the eigenvalues of a random matrix using circular markers to indicate the data points.

plot(eig(randn(20,20)),'o','MarkerSize',6)

Image shows blue circular markers distributed on a graph. No lines connect the data points.

To plot more than one complex matrix, there is no shortcut; the real and imaginary parts must be taken explicitly.

  


 © 1984-2008- The MathWorks, Inc.    -   Site Help   -   Patents   -   Trademarks   -   Privacy Policy   -   Preventing Piracy   -   RSS