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), thefftfunction, and thehilbertfunction 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, thehilberttransform came closest, but it jets off at higher frequencies (300+ Hz) for some reason. - Jacob G.xcorrandfftshould definitely work. (I'm not familiar withhilbert) - m7913d