MATLAB: I have a problem in plot function of t .this problem is related to imaginary part

walaa

plot(at, double(subs(X(n),t,at)));
title('time response');
Warning: Imaginary parts of complex X and/or Y arguments ignored

Best Answer

The various line and surface plot functions plot only the real part of their arguments. To plot complex numbers, you have four options:
  1. Plot the real and imaginary parts separately on the same axes,
  2. Plot the real and imaginary parts separately on different axes in the same figure, using subplot and plotting the imaginary parts in the second subplot,
  3. Plot the absolute value using the abs function,
  4. Plot the absolute value and phase separately on different axes in the same figure using angle and subplot for the second subplot.
Experiment with them to get the result you want. At least one of those should work for you.
Related Question