I have a pulse signal that provides a 1 for values of n from 0 to 5. I would like to shift my signal by 20 samples, however all I am doing is increasing my pulse width. What am I doing wrong exactly?
import numpy as np
import matplotlib.pyplot as plt
def pulse_s(t):
return 1 * (t <= 5)
def shift(t,a):
return pulse_s(t-a)
t1 = np.linspace(0,200)
plt.stem(t1,shift(t1,20))
plt.xlabel('n')
plt.ylabel('Amplitude')
plt.title('Pulse Signal p[n] with L = 5 and $n_0$ = 20')
plt.grid(True)