[問題]FFT作filter的問題 已回收
各位前輩您好
小弟剛剛接觸matlab,也爬過文了,但是在ifft的使用上有問題想請教大家
一開始小弟參考了matlab中的help將原本的檔案做fft
d1=load('1.txt'); % 1是我想要處理的資料
L=128; % L means the length of the sequence
NFFT = 2^nextpow2(L); % Next power of 2 from length of y
Y = fft(d1,NFFT)/L;
f = 1/2*linspace(0,1,L/2);
H=2*abs(Y(1:NFFT/2));
plot(f,H)
title('Single-Sided Amplitude Spectrum of y(t)')
xlabel('Frequency (Hz)')
ylabel('|Y(f)|')
將畫出來的頻譜圖與origin比較後是相同的
於是我把fft的結果拿去跟一個step function相乘後再ifft
希望達到filter的效果
X=zeros(128,1); % X=filter
for i=57:1:71
X(i)=1;
end
Y1=Y.*X; %將原本的檔案作filter
Y2=ifft(Y1,NFFT)*L; %將filter過的資料轉換回去
figure()
plot(abs(Y2))
但是卻發現轉換回去的結果跟origin是不同的
不知道是不是在ifft的使用上有錯誤?
謝謝各位~
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 140.112.41.210