【问题标题】:Phase shift in a signal信号中的相移
【发布时间】:2015-07-28 16:02:21
【问题描述】:

这就是我写代码的方式

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));

这是我达到的结果。但是有相移的信号和没有相移的信号是一样的。

【问题讨论】:

标签: matlab signal-processing fft


【解决方案1】:

如果您想添加相移,您只需:

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

其中 S 是偏移量(以弧度为单位)。
另外,如果您仍想绘制ifft(p1),则不应使用abs(p2),而应使用real(p2)
希望对你有帮助

【讨论】:

  • 谢谢,underscore_nico。但是,上面提到的方法我也可以使用对吗?使用 fft 和 ifft?
【解决方案2】:

可以通过乘以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

【讨论】:

    猜你喜欢
    • 2015-02-17
    • 2020-08-02
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-05-06
    • 1970-01-01
    • 2017-05-20
    相关资源
    最近更新 更多