I have two vectors that represent two different signals, each being a sine wave with the same frequency. I've tried cross-correlation, Fourier transforms, Hilbert transforms, etc, but nothing returns the correct, theoretical value (in radians) at a specific frequency (should be negative). Is there any method in Matlab to calculate the phase difference of two sine waves with the same frequency?
Note: I have access to the frequency and amplitudes of both signals, and I can post some code if needed.
xcorr
(cross-correlation), thefft
function, and thehilbert
function in an attempt to calculate the phase difference, but the values do not match up with the theoretical values at the same frequency. I expected values less (more negative) than what I had received. At low frequencies, thehilbert
transform came closest, but it jets off at higher frequencies (300+ Hz) for some reason. – Jacob G.xcorr
andfft
should definitely work. (I'm not familiar withhilbert
) – m7913d