0

I recorded a signal from a microphone. The recorded signal will have some reflections from the surrounding walls. I would like to locate these reflections. To do this I will use pulse compression. Pulse compression is acquired by estimating the direct wave of the recorded signal and correlating it with the entire signal. The reflections will be very similar to the direct wave, so the pulse compression will give peaks or valleys where there might be a reflection. The problem I am having is that the correlation ends up with a negative lag, which means that the reflections have arrived before the direct wave which does not make sense. So there has to be an error someplace. Here is an image of the entire signal. My main problem (and question) is what causes this change in lag, and how can it be negative in this situation. enter image description here

Here is the image of the cut-out direct wave that is windowed to go toward 0. enter image description here

The correlated result enter image description here

I have tested both with only the cut-out direct signal which gives the result above and with the cut-out direct wave in a zeros array of the same length as the signal, which gives a correlation peak in 0 which is also not the wanted result. The expected result should be starting around the same time as the signal (possibly a bit before)

Here are some of the codes providing the images (there is some manual cutting of the signal)

start_index = get_first_index_above_threshold(sig, threshold) #this just gives a start index above a threshold
end_index = start_index + n_sampl #n_sampl is just a chosen value by max value before expected reflections
#direct_signal = np.zeros(len(sig)) #for zero correlation peak
#direct_signal[start_index:end_index] = sig[start_index:end_index]#for zero correlation peak
direct_signal = sig[start_index:end_index].to_numpy()
sig_copy = sig.copy()
sig_copy[:start_index] = 0
compressed = signal.correlate(sig_copy,direct_signal, mode='same')

the signal is a 3-channel data frame I can provide data, but usually not popular to share data links here.

Here is an image of the correlation when I use a zeros array and place the cut signal in it before correlating. enter image description here

vegiv
  • 124
  • 1
  • 9

0 Answers0