用NI的CWDSP生成正弦波

    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
原文地址:https://www.cnblogs.com/zitjubiz/p/13522354.html