Hello Amit,
I understand that you are trying to know the reason for discrepancy in the results obtained with different methods of finding the delay between two signals.
The discrepancy you're observing between the "maxpeak" and "crosscorrelation" methods in "alignsignals" function, as well as with the "finddelay" function, stems from the different ways these methods interpret and analyze the signals to determine alignment.
1. Max Peak method in "alignsignals" function: This method identifies the maximum peak in each signal and aligns these peaks to estimate the delay. It works well when both signals have a clear, prominent peak that corresponds to the event of interest.
2. Cross-Correlation method in "alignsignals" function: This approach calculates the correlation between the two signals at various lags and identifies the lag at which the correlation is maximized. This method considers the overall shape and structure of the signals, making it generally more robust to noise but potentially sensitive to complex signal characteristics that might not align perfectly across the two signals.
3. "finddelay" function: Similar to the cross-correlation method, "finddelay" function computes the delay by maximizing the cross-correlation between the two signals producing similar results to the "crosscorrelation" method in "alignsignals" for the same reasons.
Please refer to the below documentation to learn more about the different methods in "alignsignals" function: https://www.mathworks.com/help/signal/ref/alignsignals.html#:~:text=Method%20%E2%80%94%20Method%20to%20estimate%20the%20delay%20between%20signals
Hope it helps!