MATLAB: How to find the difference of 1st minima point of 2 shifted cosine/sine wave in matlab

plot

I would like to ask if there is a way to get the 1st minima point of 2 cosine wave (one shifted to the right) and evaluate the difference in the x-axis (which is also the time-axis)?

Best Answer

Considering that you have 2 vectors cos1 and cos2 (of the same frequency) you can calculate their phase difference in rad using the formula:
acos(dot(cos1,cos2)/(norm(cos1)*norm(cos2)))