19 lines
350 B
Python
19 lines
350 B
Python
import numpy as np
|
|
import scipy as sp
|
|
import matplotlib.pyplot as plt
|
|
|
|
|
|
def main():
|
|
N = 8 # Number of points
|
|
n = np.arange(0, N) # Range of inputs
|
|
|
|
x = (-1)**n # Definition of signal
|
|
X_N = sp.fft.fft(x) # DFT of signal
|
|
|
|
plt.stem(n, X_N)
|
|
plt.show()
|
|
|
|
|
|
if __name__ == "__main__":
|
|
main()
|