How to find phase shift of accelerometer data

4 views (last 30 days)
Erick
Erick on 31 Dec 2014
Answered: Star Strider on 31 Dec 2014
I am trying to find and plot the phase shift between two accelerometers in time. Below is the basic idea I have been implementing, however it does not seem to be working for me. What am I doing wrong? Thanks for any help.
Y1Axis = DataSet(:,3);
Y2Axis = DataSet(:,4);
Fs = 3200;
N = length(Y1Axis);
ts = 1/Fs;
t = (0:N-1)/Fs;
Y1FFT = fft(Y1Axis);
Y2FFT = fft(Y2Axis);
Phase1 = angle(Y1FFT);
Phase1 = unwrap(Phase1);
Phase2 = angle(Y2FFT);
Phase2 = unwrap(Phase2);
PhaseDif = Phase1-Phase2;
plot(t, Phase1, t, Phase2, t, PhaseDif);

Answers (1)

Star Strider
Star Strider on 31 Dec 2014
It would help if you attached a .mat file of a relevant excerpt of ‘DataSet’, and a slightly more detailed description of what you’re doing.
See the documentation for xcorr as well. Specifically, under Examples, see ‘Delay Between Two Correlated Signals’. That may be what you want.

Community Treasure Hunt

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

Start Hunting!