Rowan-Classes/6th-Semester-Spring-2024/DSP/Labs/Lab-02/lab-02-6.py
2024-02-23 21:42:45 -05:00

28 lines
495 B
Python

import numpy as np
import matplotlib.pyplot as plt
x = np.array([1, -5, 4, 8, 6, -3, -1])
n = np.arange(7)
x1 = x[(n+3)%7]
x2 = x[(n-4)%7]
x3 = x[(-n+2)%7]
plt.subplot(221)
plt.scatter(n,x)
plt.title("$x[n]$")
plt.subplot(222)
plt.scatter(n,x1)
plt.title("$x\left[\langle n + 3\\rangle_7\\right]$")
plt.subplot(223)
plt.scatter(n,x2)
plt.title("$x\left[\langle n - 4\\rangle_7\\right]$")
plt.subplot(224)
plt.scatter(n,x3)
plt.title("$x\left[\langle -n +2\\rangle_7\\right]$")
plt.show()