使用正弦输入,我试图修改它的频率,以削减频谱中的一些较低频率,将主频率移向零。由于信号未进行fft移位,因此我尝试通过在fft向量的开头和结尾处消除一些样本来做到这一点:
interval = 1; samplingFrequency = 44100; signalFrequency = 440; sampleDuration = 1 / samplingFrequency; timespan = 1 : sampleDuration : (1 + interval); original = sin(2 * pi * signalFrequency * timespan); fourierTransform = fft(original); frequencyCut = 10; %% Hertz frequencyCut = floor(frequencyCut * (length(pattern) / samplingFrequency) / 4); %% Samples maxFrequency = length(fourierTransform) - (2 * frequencyCut); signal = ifft(fourierTransform(frequencyCut + 1:maxFrequency), 'symmetric'); 但是它没有按预期工作。我也尝试删除频谱的中心部分,但它也产生了更高频率的正弦波。
如何使它正确?
回答:
@ las3rjock:
它更像是对信号本身进行下采样,而不是对FFT进行
下采样 。
或者,您可以创建一个
时间序列对象,然后使用
resample方法对其进行
重新采样 。
编辑:
一个类似的例子:)
% generate a signal Fs = 200; f = 5; t = 0:1/Fs:1-1/Fs; y = sin(2*pi * f * t) + sin(2*pi * 2*f * t) + 0.3*randn(size(t)); % downsample n = 2; yy = downsample([t' y'], n); % plot subplot(211), plot(t,y), axis([0 1 -2 2]) subplot(212), plot(yy(:,1), yy(:,2)), axis([0 1 -2 2])
更多&回答...