[英]Straightening amplitude-frequency response graph after FFT
我已經將對數掃描正弦(帶有一些淡入淡出/淡出)加載到Matlab中並通過fft函數運行並使用semilog繪制它。
輸入信號幅度在10 ... 20000 Hz范圍內幾乎恆定。 因此,為了更准確地表示正在發生的事情,我希望將圖形看作幾乎水平線。
我應該采用什么公式來使AFR圖表水平?
我用來繪制圖表的Matlab腳本:
fid = fopen('sweepfaded.raw','rb'); %open file
data = fread(fid, inf, 'float32'); %read in the data
fclose(fid); %close file
n = size(data,1);
n = 2^nextpow2(n); % Next power of 2 from length of audio - 2-powers are faster to calculate
p = fft(data, n); % take the fourier transform
nUniquePts = ceil((n+1)/2);
p = p(1:nUniquePts); % select just the first half since the second half
% is a mirror image of the first
p = abs(p); % take the absolute value, or the magnitude
p = p/n; % scale by the number of points so that
% the magnitude does not depend on the length
% of the signal or on its sampling frequency
p = p.^2; % square it to get the power
sampFreq = 44100;
freqArray = (0:nUniquePts-1) * (sampFreq / n); % create the frequency array
semilogx(freqArray, 10*log10(p))
xlabel('Frequency (Hz)')
ylabel('Power (dB)')
得到的圖我希望是水平的(比如對它應用一些旋轉,所以范圍100 ... 10000 Hz變成水平線):
PS我不擅長音頻信號處理,我只是一個通用的程序員,所以不要浪費你的時間來解釋發生了什么(雖然我想,總有一天我不得不讀一本好的DSP書)。 只需一個正確的公式插入我的Matlab腳本就足夠了。
響應校正因子將取決於對數掃描的確切速率。 通過在FFT之前使用合適的窗函數,可以減少低頻拐角處的一些扇形。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.