I have one timeseries input signal of variable frequency, and corresponding output signal. I want to measure phase shift between the two signals?

9 次查看(过去 30 天)
Input signal has variable frequency throughout the timeseries data. The output signal has the same frequency of input data as well as another autonomous frequency. I am expecting the phase shift between these two signals at some point. I want to accurately estimate the phase angle between the two signals.

回答(1 个)

Prathamesh
Prathamesh 2023-7-27
Hi,
I understand that you want to know how to calculate phase shift between input and output signals with timeseries data.
You can use “FFT” to calculate the phase shift of the timeseries data. “FFT” will convert the time domain signal into frequency domain and then you can just subtract the phases of input and output signals to get phase shift.
t = 0:0.1:10;
f = 10 + sin(t);
x = sin(2*pi*f.*t);
tsx = timeseries(y,t);
y = sin(2*pi*f.*t + pi/4);
tsy = timeseries(x,t);
X = fft(tsx.Data);
Y = fft(tsy.Data);
phase_shift = angle(Y) - angle(X);
Refer to the documentation attached to get more information on “fft” and frequency domain analysis.
I hope this resolve your issue.

Community Treasure Hunt

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

Start Hunting!

Translated by