fft - Matlab: finding phase difference using cpsd -
from understanding, when using cpsd function such:
[pxy,f] = cpsd(x,y,window,ns,nfft,fs);
matlab chops time series data smaller windows size specified you. , windows shifted ns data point. final [pxy, f]
average of results obtained each individual window. please correct me if wrong process.
my question is, if use angle(pxy)
@ specific frequency, 34hz. give me phase difference between signal x
, y
@ frequency 34hz?
i having doubt because if pxy
average between each individual window, , because each individual offset window shift, doesn't mean averaged pxy
's phase affected window shift?
i've tried correct ensuring window shift corresponds integer of full phase difference corresponding 34hz. correct?
and little background doing:
i have numerous time-series pressure measurement on 60 seconds @ 1000hz sampling rate.
power spectrum analysis indicates there peak frequency @ 34 hz each signal. (averaged on windows)
i want compare each signal's phase difference each other corresponding 34hz peak.
fft analysis of individual window reveals peak frequency moves around. not sure if cpsd correct way going this.
i considering trying use xcorr calculate overall time lag between signals , calculate phase difference that. have heard of hilbert transform, got no idea how works yet.
yes, cpsd works. can test result set 2 input signals, such as:
t=[0:0.001:5]; omega=25; x1=sin(2*pi*omega*t); x2=sin(2*pi*omega*t+pi/3);
you can check whether phase shift calculated cpsd pi/3.
Comments
Post a Comment