信号中的相移

时间:2015-07-27 12:57:45

标签: matlab signal-processing fft

这就是我编写代码的方式

fc = 10;
td = 5000;
fs = 3*fc;
ts = 1/fs;
t = 0:ts:1-ts;
a = 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));

这是我实现的结果。然而,具有相移的信号与没有相移的信号相同。

enter image description here

enter image description here

2 个答案:

答案 0 :(得分:1)

如果您想添加相移,您只需要这样做:

a = cos(2*pi*fc*t + S);

其中S是移位(以弧度表示)。
另外,如果你仍想绘制ifft(p1)你不应该abs(p2)real(p2)。 我希望这有帮助

答案 1 :(得分:1)

您可以通过乘以exp(-1i*2*pi*p*td)在FT域中添加延迟,它是正确的。

fft默认情况下不居中(对此使用fftshift),DC位于索引1.因此p不对,请尝试使用p = 0:fs/nfft:1-fs/nfft;

编辑:似乎并不完全清楚。如果您使用p = 0:fs/nfft:1-fs/nfft;,请不要使用fftshift。如果您想使用fftshift,则p必须为-1/2+fs/nfft:fs/nfft:1/2