FFT计算结果幅值如何修正? |
您所在的位置:网站首页 › f值怎么算p值 › FFT计算结果幅值如何修正? |
最近在做频谱分析,发现使用hanning窗函数+fft算法,对matlab生成信号: 0.7*sin(2*pi*50*t) + sin(2*pi*120*t)进行频谱分析,发现结果中信号幅值衰减,代码如下,如何对幅值修正,才能使fft结果中的幅值不衰减? Fs = 9000; % Sampling frequency Ts = 1/Fs; % Sampling period L = 17000; % Length of signal t = (0:L-1)*Ts; % Time vector Signal = 0.7*sin(2*pi*50*t) + sin(2*pi*120*t); Signal = Signal'; %% fsU = 1/Ts; %% frequency window WinCoeff = 2; HannWin = hann(L); UPhaCurrWin = Signal .* HannWin; %% fft %fft FreSpcU = fft(UPhaCurrWin); %amplitude AmpU = abs(FreSpcU/L); AmpUtemp = AmpU(1:(fix(L/2)));% remove the direct current component,because the 0Hz component has not been divide into two parts. AmpUtemp(2:end) = 2*AmpUtemp(2:end);%above 0Hz components, the Amp need been multiplicated 2, because the result of fft is symmetric spectrum there are two AmpUtemp = AmpUtemp *WinCoeff; %Fre f = Fs/L *(0:(fix(L/2)-1)); %Plot plot(f,AmpUtemp); title('Frequency Spectrum') xlabel('Fre/Hz') ylabel('Amp/A') |
今日新闻 |
推荐新闻 |
CopyRight 2018-2019 办公设备维修网 版权所有 豫ICP备15022753号-3 |