https://nl.mathworks.com/help/signal/ref/alignsignals.html
alignsignals - Align two signals by delaying earliest signal - MATLAB
This MATLAB function estimates the delay D between two input signals, x and y, and returns D along with the aligned signals xa and ya.
aligntwosignalsdelayingearliest