I have two signals from two different sensors. I cropped the area i am interested in from both sensor signals. The problem is that the signals start at different time instants. I am searching for a way to align the signals just like below. It is technically just moving the blue signal to align with orange one. I tried using cross correlation but it gave a weird result. Any help please. first image: this is the result of cross correlation of two signals Second image :after applying code on cross correlation to align
If the signals themselves are entirely different and you just want to align based on the envelope, then in that case, take the envelope by low pass filtering the absolute value, scale each by its rms value, and adjust the delay while subtracting the two scaled envelopes and evaluate the least squared error (sum the square of the errors between the waveforms sample by sample), when this sum is at the minimum you have optimally aligned the two.