Jump to content
  • 0

Use AnalogOut SDK function to generate Sine Wave


lokobob99

Question

Hey everyone,

I have a (simple) question: How could you use the SDK functions to generate a sine wave, which is a combination of e.g. 2 different frequencies? So, lets say for example, you have the following code:

print("Generating sine wave...")

dwf.FDwfAnalogOutNodeEnableSet(hdwf, c_int(0), AnalogOutNodeCarrier, c_int(1))

dwf.FDwfAnalogOutNodeFunctionSet(hdwf, c_int(0), AnalogOutNodeCarrier, funcSine)

dwf.FDwfAnalogOutNodeFrequencySet(hdwf, c_int(0), AnalogOutNodeCarrier, c_double(12000))

dwf.FDwfAnalogOutNodeAmplitudeSet(hdwf, c_int(0), AnalogOutNodeCarrier, c_double(0.705))

dwf.FDwfAnalogOutConfigure(hdwf, c_int(0), c_int(1))

 

This generates a sine wave with a frequency of 12000 Hz. Now let's say I want to generate a second sine wave with a frequency of 5000 Hz:

print("Generating sine wave...")

dwf.FDwfAnalogOutNodeEnableSet(hdwf, c_int(0), AnalogOutNodeCarrier, c_int(1))

dwf.FDwfAnalogOutNodeFunctionSet(hdwf, c_int(0), AnalogOutNodeCarrier, funcSine)

dwf.FDwfAnalogOutNodeFrequencySet(hdwf, c_int(0), AnalogOutNodeCarrier, c_double(5000))

dwf.FDwfAnalogOutNodeAmplitudeSet(hdwf, c_int(0), AnalogOutNodeCarrier, c_double(0.705))

dwf.FDwfAnalogOutConfigure(hdwf, c_int(0), c_int(1))

 

Now I would like to add these two sine signals, so that the output signal contains frequency components of 12000 Hz and 5000 Hz.

Thanks in advance for any help! 

PS: My goal with the custom signal is to use the FFT to get the 2 frequency components (5000 and 12000 Hz).

Kind regards


 

Link to comment
Share on other sites

3 answers to this question

Recommended Posts

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...