【发布时间】:2015-07-23 12:02:47
【问题描述】:
我对在 Matlab 脚本中实现的基本时间/频率属性有疑问。 属性是:
我尝试在 Matlab 脚本中实现这一点。 我假设一个频率值为 5Hz 的正弦信号,采样频率等于 800Hz,我想将此信号延迟 1.8 秒。 所以我实现了这个脚本:
Fs = 800;
Time_max = 4; % seconds
t = 0:(1/Fs):Time_max;
delay = 1.8; % One second of delay
f = 5; %Hz
y = sin(2 * pi * f * t);
figure
subplot(2,1,1)
plot(t,y);
xlabel('time (s)')
legend('Original');
%FFT
SIZE = 2^nextpow2(length(y));
Y = fft(y,SIZE);
df = Fs/SIZE;
f= -Fs/2:df:Fs/2 - df;
for k = 1:SIZE
Y(k) = Y(k)*exp(-(1i*2*pi*f(k)*delay));
end
subplot(2,1,2)
plot(real(ifft(Y)),'r')
legend('Shifted');
输出图是:
问题出在哪里?如何实现正确的时间延迟?
谢谢
【问题讨论】:
-
抱歉图片链接,但由于我的声誉,我无法发布图片。
标签: matlab signal-processing fft