Const Pts = 8192 ' number of samples - ' must be a power of two for the AutoPowerSpectrumFunction Const AmpNoise = 0.2 'amplitude of the noise Const AmpData = 5 ' amplitude of the sine wave Const SineWaveFreq = 25 ' frequency of sine wave ' generate random data between -AmpNoise & AmpNoise Noise = CWDSP1.WhiteNoise(Pts, AmpNoise, Timer Mod 32767) ' generate the sine wave Waveform = CWDSP1.SineWave(Pts, AmpData, SineWaveFreq / Pts, phase) For n = 0 To UBound(Waveform) Waveform(n) = Waveform(n) + 5 Next ' add the noise & the data 'Waveform = CWArray1.AddArray(Waveform, Noise) CWGraph1.Plots(1).PlotY Waveform waveForm1 = CWDSP1.SineWave(Pts, 4.9, 25 / Pts, phase) For n = 0 To UBound(waveForm1) waveForm1(n) = waveForm1(n) + 4.9 Next CWGraph1.Plots(2).PlotY waveForm1, -240
正弦波FFT变换后的波形
加个汉宁窗函数,不知道是不是这样
0.5 - 0.5 * Cos((2 * Pi * (当前点数 - 1)) / (总点数 - 1))
波幅变小了. 目测是600Hz内的波幅都变小了, >600Hz的波幅变大了. 计算总值要取多少Hz以内的?