A left shift of t0 in a signal can be obtained by convolving it with δ(t+t0). I want to obtain this in python using discrete signals by only using the np.convolve
operator in mode='full'
. Note that I can’t use np.roll
or assignment from an index like [shift:]
. It has to be obtained purely by convolution. Here’s an example:
signal = np.array([1, 2, 3, 4, 5, 6, 7, 8, 9])
shift = 3
filter = ??
shifted_signal = np.convolve(signal, filter, mode='full')
print(shifted_signal)
[4, 5, 6, 7, 8, 9, 0, 0, 0, ...
The number of zeros at the right side, or to say the length of shifted_signal
is not important. But I want the signal to start from the correct position. What should the filter
be such that I get the desired output? I need it this way because I am trying to obtain the left shift from an FFT analysis. A left shift of t0 in the time domain corresponds to a multiplication of ei2πft0 in the frequency domain. I can obtain t0 by comparing the shifted signal with the original in the frequency domain. But to check if my algorithm works, I just can’t think of a filter that performs a left shift in the time domain.
I tried filter = [0, 0, 0, 1]
and filter = [1, 0, 0, 0]
but they adds zeros to the left and right of the signal. The signal itself doesn’t start from the desired index. I have no idea what other filter I can use to obtain the desired result.