Getting mismatched and wrong answer

1 view (last 30 days)
Amit
Amit on 4 Apr 2024
Answered: Sai Pavan on 15 Apr 2024
I have 2 signal data.
reference_sig.mat = reference signal
SecondPostion_IntensityProfile.mat = Testing signal [ size= ( 126x201); 201 = frames]
My main aim is to find the delay between the 2 signals.
I selected specific frame 100 and 200.
When I use alignsignals function with "Method = maxpeak" I am getting correct answer (annswer should be 3)
But with this same function with crosscorrelation method I am getting answer zero which is wrong, If you plot those 2 signals you will under stand.
I tried the same thing with "finddelay" function where I am getting the same wrong value 0.
I am relly confused with this discrepency answer in different methods.
YOur opinion will asist me to understand.
Thank you very much.

Answers (1)

Sai Pavan
Sai Pavan on 15 Apr 2024
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!

Products


Release

R2023a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!