我有一个wav
格式的0.25秒音频文件,我想删除一些频率。
1)首先,我进行FFT以获取频谱
2)然后我输入一些要删除的频率和一个容差
3)删除频率后,我将进行IFFT以获取未删除频率的原始信号
我对IFFT之后的结果感到有些困惑。我已经删除了所有高于400Hz的频率,并且在我的IFFT中x(t)的频率高于该频率吗?
由于FFT对称,在FFT转换中出现了问题吗?
https://imggmi.com/full/2019/7/16/4febff13474871261e8c77c2d5e3f63b-full.jpg.html https://cdn1.imggmi.com/uploads/2019/7/16/11687331ba65166480a2ae3d794e4aa1-full.jpg
在此先感谢您的帮助!! BR Mathias
clear all;
close all;
%Wav File einlesen und die Daten in data und Abtastrate in Fs
[data,Fs]=audioread('Mono_120A_v20_02sec.wav');
%Ermittlung der Arraygröße
[nSamples,nChannels]=size(data);
%Länge der Audiodatei ermitteln
waveFileLength=nSamples/Fs;
t=[0:length(data)-1] / Fs;
%Signal darstellen
subplot(3,2,1)
plot(t,data)
title('Audio')
xlabel('Zeit')
ylabel('X(t)')
%FFT des Signal
y_fft = abs(fft(data)); %Retain Magnitude
y_fft = y_fft(1:nSamples/2); %Discard Half of Points
f = Fs*(0:nSamples/2-1)/nSamples; %Prepare freq data for plot
%Plot Sound File in Frequency Domain
subplot(3,2,2)
plot(f, y_fft)
grid on
xlim([0 20000])
% ylim([0 200])
xlabel('Frequency (Hz)')
ylabel('Amplitude')
title('Freqenzbereich 70A')
yy=fft(data);
yyy=fftshift(yy);
f=Fs.*(-nSamples/2:nSamples/2-1)/nSamples;
subplot(3,2,3)
plot(f,(yyy.*conj(yyy)/(nSamples*nSamples)));
title('FFT')
%%%%%%%%%%%%%%%%%%%
Fdelete = 15000; % Diese Frequenz soll gelöscht werden
tolerance = 14600; % Toleranz um die Frequenz
idx_p = find(f>Fdelete-tolerance & f<Fdelete+tolerance); % Löschen der Frequenzen
idx_n = find(f>(Fs-Fdelete)-tolerance & f<(Fs-Fdelete));
idx = [idx_p idx_n];
yyy(idx) = 0;
Fdelete = -15000;
tol = 14600; % Toleranz um die Frequenz
idx_p = find(f>Fdelete-tolerance & f<Fdelete+tolerance); % Löschen der Frequenzen
idx_n = find(f>(Fs-Fdelete)-tolerance & f<(Fs-Fdelete));
idx = [idx_p idx_n];
yyy(idx) = 0;
subplot(3, 2, 4)
% plot(f, yyy); title('After');
plot(f,(yyy.*conj(yyy)/(nSamples*nSamples)));
title('After')
%%%%%%%%%%%%%%%%%%%
subplot(3, 2, 6)
plot(t,data)
title('origin x(t)')
xlabel('Zeit')
ylabel('X(t)')
%%%%%%%%%%%%%%%%%%%
subplot(3, 2, 5)
y1=ifft(yyy,'symmetric');
plot(t,y1),grid on;
title('IFFT x(t)')
答案 0 :(得分:0)
在一般情况下,将FFT档归零不会“删除频率”。