import numpy as np import matplotlib.pyplot as plt def main(): n = np.arange(7) # n ranges from 0 to 7 (not including 7) x = np.array([1, -5, 4, -8, 6, -3, -1]) x_1 = x[(n+3) % 7] # x[ _7 ] x_2 = x[(n-4) % 7] # x[ _7 ] x_3 = x[(-n+2) % 7] # x[ <-n+2>_7 ] plt.subplot(411) plt.stem(n,x) plt.ylabel("$x[n]$") plt.subplot(412) plt.stem(n,x_1) plt.ylabel(r"$x[\langle n+3 \rangle_7]$") plt.subplot(413) plt.stem(n, x_2) plt.ylabel(r"$x[\langle n-4\rangle_7]$") plt.subplot(414) plt.stem(n, x_3) plt.ylabel(r"$x[\langle -n+2\rangle_7]$") plt.xlabel("$n$") plt.show() if __name__ == "__main__": main()