Complex number troubles with numpy

When you specify the array x and X you need to make sure it is of complex data type, i.e:

x = zeros((4),dtype=complex)

EDIT:

To fix the plot you need to plot both real and imaginary parts:

plt.plot(X.real,X.imag)
plt.plot(fx.real,fx.imag, 'ro')

This gives me:

….which looks like your Matlab graph.

Leave a Comment