user3734366 user3734366 - 1 year ago 135
Python Question

Got an extra line on pyton plot

i'm using pyplot to show the FFT of the signal 'a', here the code:


and i get this figure
enter image description here

There is a line from the begin to the end of the signal in the frequency domain. How i can remove this line? i'm doing something wrong with pyplot?

Thank You

Answer Source

Have a look at plt.plot(numpy.fft.fftfreq(x.shape[-1]): the first and last points are the same, hence the graph "makes a loop"

You can do plt.plot(sorted(numpy.fft.fftfreq(x.shape[-1])),myFFT) or plt.plot(myFFT)

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download