finding phase using autocorrelation

Discussion in 'Wireless & RF Design' started by ashwini1, Dec 8, 2009.

  1. ashwini1

    Thread Starter New Member

    Aug 1, 2009
    9
    0
    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
     
Loading...