matlab - Phase shift in a signal -
this how writing code
fc = 10; td = 5000; fs = 3*fc; ts = 1/fs; t = 0:ts:1-ts; = cos(2*pi*fc*t); figure, plot(a); y = fftshift(fft(a)); nfft = length(y); p = 0:fs/nfft:1-fs/nfft; p1 = y.*exp(-1i*2*pi*p*td); p2 = ifft(ifftshift(p1)); figure, plot(abs(p2)); this result achieve. signal phase shift same signal without phaseshift.
you can add delay in ft domain multiplying exp(-1i*2*pi*p*td), it's right.
but fft not centered default (use fftshift that), dc @ index 1. p not right, try p = 0:fs/nfft:1-fs/nfft; instead.
edit: seems not clear. if use p = 0:fs/nfft:1-fs/nfft;, don't use fftshift. if want use fftshift, p must -1/2+fs/nfft:fs/nfft:1/2.


Comments
Post a Comment