Rowan-Classes/8th-Semester-Spring-2025/clinic-consultant/labs/lab-4/lab4q1.py
2025-03-31 23:54:32 -04:00

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()