ashwini1
Member level 1
Hi,
I have a 30Hz wave, where i have introduced a phase shift of 45 degrees. Somewhere i read that the phase info can be computed based on auto correlation function. I tried and i did not get required output. Here is my code, can anyone tell me that what is wrong in this.
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.
Any help plz ..
Thanks,
Ashwini
I have a 30Hz wave, where i have introduced a phase shift of 45 degrees. Somewhere i read that the phase info can be computed based on auto correlation function. I tried and i did not get required output. Here is my code, can anyone tell me that what is wrong in this.
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.
Any help plz ..
Thanks,
Ashwini