[英]increase / decrease the frequency of a signal using fft and ifft in matlab / octave
[英]fft/ifft: Sampling Frequency and Length of Signal
這部分來自Matlab fft文檔:
Fs = 30; % Sampling frequency
T = 1/Fs; % Sample time
L = 130; % Length of signal
t = (0:L-1)*T; % Time vector
x = sin(2*pi*1*t); % 1 Hz sinus
plot(real(ifft(abs(fft(x))))); % fft then ifft
% Fs = 30, L = 60 / 90 / 120 ... : ok
% Fs = 20, L = 60 / 80 / 100 ... : ok
% Fs = 30, L = 50 / 70 / 80 ... : not ok
在我看來,只要信號的長度是采樣頻率的倍數,正弦曲線就會被正確地重建(除了一些移位),例如這里Fs = 30, L = 60
:
但是,如果例如Fs = 30, L = 80
(不是倍數),則結果看起來很奇怪:
這種行為是否正確? 為什么會發生這種情況,我該如何避免這種情況? 只是扔掉信號的某些部分,使長度“適合”采樣頻率?
當你在ifft中使用abs(fft())時,你只使用信號的幅度並丟棄所需的相位信息。
使用整個信號(刪除abs):
plot(real(ifft(fft(x)))); % fft then ifft
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.