finding phase using autocorrelation

Thread Starter

ashwini1

Joined Aug 1, 2009
9
Hi,

Is it possible to compute phase delay from auto correlation of a given wave?
I heard it from someone and i followed the method told to me, here is the matlab code:

Fs=100e3;
t=[0:Fs]/Fs;
x=sin(2*pi*30*t+(45*pi/180));
c=xcorr(x);
t1=[-100e3:100e3];
plot(t1,c);

[val,index]=max(c);
lag=t1(index);
ph=lag*180/pi;

i suppose to get ph=45; instead i am getting 0.

Is this correct ?? Any help plz..
Thanks,
Ashwini
 
Top